Forms

Duration Input

A duration input backed by Temporal.Duration. It uses number fields with steppers for hours and minutes, plus an optional seconds field, and drops into a form as is.

ReactVueWeb Components
View in Storybook

Playground

Examples

<DurationInput defaultValue={Temporal.Duration.from({ hours: 1, minutes: 30 })} onChange={setDur} />
<DurationInput withSeconds value={dur} onChange={setDur} disabled />

Props

Name Type Default Description
value Temporal.Duration | null Controlled value. `null` represents an empty / unset duration.
defaultValue Temporal.Duration | null Initial value when uncontrolled. @default null
onChange (value: Temporal.Duration | null) => void Called with the new `Temporal.Duration` (or `null` when all fields are empty).
withSeconds boolean false Show a seconds field in addition to hours and minutes. @default false
disabled boolean false Disable all fields. @default false
size 'sm' | 'md' | 'lg' md Control size. @default 'md'
status 'primary' | 'danger' | 'warning' | 'success' | 'info' | 'neutral' Status modifier.
name string Native `name` forwarded to a hidden serialization input.
id string `id` applied to the wrapping group element.
hoursLabel string Hours Accessible label for the hours field. @default 'Hours'
minutesLabel string Minutes Accessible label for the minutes field. @default 'Minutes'
secondsLabel string Seconds Accessible label for the seconds field. @default 'Seconds'

Accessibility

  • Body/background contrast is ≥ 7:1 (AAA) in both light and dark.
  • Every interaction works with the keyboard alone.
  • The focus ring is always visible.
  • Respects prefers-reduced-motion and stops excessive motion.

Every component is designed to meet WCAG 2.1 AAA.