- Accordion
- Avatar
- Badge
- Breadcrumb
- Button
- Calendar
- ChatContainer
- ChatInput
- ChatMessage
- ChatMultiChoiceQuestion
- ChatMultiOptionQuestion
- ChatThinking
- Checkbox
- Combobox
- Container
- CurrencyInput
- DistributionSlider
- Drawer
- Dropdown
- FilePicker
- Grid
- Heading
- Image
- Input
- InputGroup
- Label
- Logo
- MapPin
- Markdown
- Modal
- NativeSelect
- NumberInput
- OptionSlider
- OtpInput
- PhoneInput
- Popover
- Progress
- PropertyCalendar
- RadioGroup
- RadioGroupCards
- ResponsiveModal
- ScrollArea
- SearchBar
- SearchBarFallback
- SearchInput
- Select
- Separator
- Spinner
- Switch
- Table
- Tabs
- Text
- Textarea
- TimePicker
- Toast
- Toggle
- ToggleCard
- ToggleGroup
- Toolbar
- Tooltip
TimePicker
A time selection component combining a free-text input with a dropdown of scrollable hour, minute, optional second, and optional AM/PM columns
pnpm add @wandercom/design-system-web
import { TimePicker } from '@wandercom/design-system-web/ui/time-picker';
export function Example() {
return <TimePicker defaultValue="09:30 AM" interval={15} />;
}The format prop accepts a colon-delimited string built from the following tokens:
hh— hour, two digits. Behaves as 12-hour when anatoken is present, 24-hour otherwise.mm— minute, two digits. Stepped byinterval.ss— second, two digits. Stepped bysecondInterval.a— AM/PM meridiem.
Supported formats: "hh:mm:a" (default), "hh:mm:ss:a", "hh:mm:ss", "hh:mm".
The value and defaultValue props are strings matching this format (e.g. "09:30 AM" for hh:mm:a, "14:45:30" for hh:mm:ss).
The default example shows the empty state, a populated value, the disabled state, and the invalid state via aria-invalid.
<TimePicker />
<TimePicker defaultValue="09:30 AM" />
<TimePicker defaultValue="09:30 AM" disabled />
<TimePicker defaultValue="09:30 AM" aria-invalid />Add a ss token to the format to render a third scrollable column. Use secondInterval to control its step independently of interval.
<TimePicker
defaultValue="09:30:00 AM"
format="hh:mm:ss:a"
secondInterval={1}
/>
<TimePicker
defaultValue="14:45:30"
format="hh:mm:ss"
secondInterval={5}
/>Omit the a token to render a 24-hour clock. The hour column lists 00 through 23 and the input accepts and emits 24-hour values.
<TimePicker defaultValue="14:30" format="hh:mm" />The size prop matches the size variants on InputGroup.
<TimePicker defaultValue="09:30 AM" />
<TimePicker defaultValue="09:30 AM" size="sm" />The interval prop controls how the minute column is stepped. The minute portion of any committed value is snapped down to the nearest multiple.
<TimePicker defaultValue="09:00 AM" interval={15} />
<TimePicker defaultValue="13:30" format="hh:mm" interval={30} />
<TimePicker defaultValue="09:07 AM" interval={1} />Pass value and onChange to control the time externally. The callback receives a string matching format.
const [value, setValue] = useState('09:30 AM');
<TimePicker value={value} onChange={setValue} interval={5} />;value?:
defaultValue?:
onChange?:
format?:
interval?:
secondInterval?:
placeholder?:
open?:
defaultOpen?:
onOpenChange?:
disabled?:
aria-invalid?:
name?:
required?:
size?:
openLabel?:
pickerLabel?:
className?:
- The trigger is a button with
aria-haspopup="dialog"andaria-expandedreflecting the open state.EnterandSpaceopen the dropdown. - Each column inside the dropdown is a
role="listbox"(labeledHours,Minutes,Seconds,AM or PM) withrole="option"cells; the active cell carriesaria-selected="true". - On open, focus lands on the currently selected hour, or on
12when no value is set. - Within a column:
ArrowUp/ArrowDownmove focus,Home/Endjump to the first or last cell,EnterorSpaceselects the cell. TabandShift+Tabmove between columns in display order.EnterorSpaceon a cell in the last digit column commits the selection and closes the popover. The AM/PM column never auto-closes — toggling meridiem leaves the dropdown open so the user can keep adjusting.Escapecloses the popover without committing pending typed-but-uncommitted input changes; focus returns to the trigger.- Manual typing into the input is validated against
formaton blur and onEnter. Invalid input reverts to the last committed value; valid input is snapped tointervalandsecondIntervalbefore commit.
intervalandsecondIntervalare floored and clamped to a minimum of 1.- 12-hour formats expect hours
1–12; 24-hour formats expect0–23. Values outside these ranges are treated as invalid input and revert on commit. - The
ameridiem token matches mainstream date libraries (date-fns, dayjs, moment).