Skip to content

Duration

How long something took, in the unit that reads best: 840 ms, 2.3 s, 4 min. clock writes 1:04:09.

import { Duration, ValueSkeleton } from '@sypnia/ui/react'

On this page
  1. Durations
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

Durations

Response
184 ms
Build
42.6 sec
Migration
12 min
Backup
2.5 hr
Session replay
1:04:09
Code
import { Duration, KeyValue } from '@sypnia/ui/react';

// The unit that reads best; clock for times people compare as a clock.
export default function Runs() {
  return (
    <KeyValue items={[
      ['Response', <Duration key="a" ms={184} />],
      ['Build', <Duration key="b" ms={42_600} />],
      ['Migration', <Duration key="c" ms={720_000} />],
      ['Backup', <Duration key="d" ms={9_000_000} />],
      ['Session replay', <Duration key="e" ms={3_849_000} clock />],
    ]} />
  );
}

Skeleton

42.6 sec
Code
import { Duration, ValueSkeleton } from '@sypnia/ui/react';

// A duration and its skeleton.
export default function Skeleton() {
  return (
    <div className="sy-cols sy-cols--stack">
      <span><Duration ms={42600} /></span>
      <span><ValueSkeleton chars={6} /></span>
    </div>
  );
}

When to use it

Use it when

  • Response times, builds, backups.
  • clock for recordings and runs people compare as a clock.

Do not use it when

  • A moment in time: use Time.

For everyone

  • Rounded durations carry the exact milliseconds in their title.

Props

DurationTypeDefault
msrequired number | null | undefined
clock boolean
ValueSkeletonTypeDefault
chars number 6
  1. Durations
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms