Duration Picker

A duration input with hours, minutes and seconds segments that support scrubbing, typing and full keyboard control.

Open in v0

Last updated: August 13, 2026

Installation

npx smoothui-cli add duration-picker

Features

  • Segmented hours / minutes / seconds input, configurable via units
  • Controlled and uncontrolled value in seconds
  • Horizontal pointer drag to scrub any segment up or down
  • Full keyboard control: arrow keys, Shift for ×10 steps, Page Up/Down, Home/End
  • Direct digit typing with auto-advance and carry into the next unit
  • Odometer-style digit roll animation on change
  • formatDuration helper exported for formatting a duration elsewhere in your app
  • Respects prefers-reduced-motion

Accessibility

ARIA Attributes

AttributeElementPurpose
role="group"Picker containerGroups the unit segments as one control
aria-labelledby / aria-labelPicker containerAssociates the visible label, or provides a fallback name
role="spinbutton"Each unit segmentIdentifies the segment as an adjustable numeric control
aria-valuenowEach unit segmentCurrent value of that unit
aria-valuemin / aria-valuemaxEach unit segmentValid range for that unit given its position
aria-valuetextEach unit segmentHuman-readable value, e.g. "23 minutes"
aria-disabledEach unit segmentReflects the disabled prop

Keyboard

KeyAction
Arrow Up / Arrow DownIncrease/decrease the focused segment by step
Shift + Arrow Up/DownIncrease/decrease by step × 10
Page Up / Page DownIncrease/decrease by a larger step
Home / EndJump the focused segment to its minimum/maximum
Arrow Left / Arrow RightMove focus to the previous/next segment
0-9Type a value directly; a second digit commits and advances focus

Screen Reader

  • Each segment announces its unit, current value and range as a standard spinbutton.
  • The picker container exposes a single accessible name via aria-labelledby (when label is set) or a fallback aria-label.

Reduced Motion

When prefers-reduced-motion is enabled, the digit roll animation is skipped entirely — digits update instantly with no transform or opacity transition.

Props

Created by

Powered by

motion.dev

© 2026 SmoothUI. Built by Eduardo Calvo.