Time Picker

TimePicker lets users select a time from a list of generated options.

tsx
import { TimePicker } from '@/components/ui/wideset/timepicker/Timepicker';

<TimePicker placeholder="Start time" defaultValue="09:00" />

Installation

pnpm dlx wideset add timepicker

Copies the component and any Wideset components it uses into your project.

Examples

Variants

danger marks a time that failed validation, such as an end before the start. It changes only the colour: put the reason in the FormField's errorText, which FormField links to the control, because the red border alone does not reach screen reader users.

tsx
import { TimePicker } from '@/components/ui/wideset/timepicker/Timepicker';

export default function TimePickerVariants() {
  return (
    <div className="gap-ws-5 flex flex-wrap items-center justify-center">
      <TimePicker className="w-[10rem]" aria-label="Start time" defaultValue="09:00" />
      <TimePicker
        className="w-[10rem]"
        variant="danger"
        aria-label="End time"
        defaultValue="08:00"
      />
    </div>
  );
}

Presets

border is the standalone field of a form. ghost drops the frame for a picker that sits inside a surface that already draws one, such as a table row or a toolbar.

tsx
import { TimePicker } from '@/components/ui/wideset/timepicker/Timepicker';

export default function TimePickerPresets() {
  return (
    <div className="gap-ws-5 flex flex-wrap items-center justify-center">
      <TimePicker
        className="w-[10rem]"
        preset="border"
        aria-label="Start time"
        placeholder="Start time"
      />
      <TimePicker
        className="w-[10rem]"
        preset="ghost"
        aria-label="Start time"
        placeholder="Start time"
      />
    </div>
  );
}

Sizes

The same three heights as Text input and Select, so a date and a time picker line up in one row. Medium is the default.

tsx
import { TimePicker } from '@/components/ui/wideset/timepicker/Timepicker';

export default function TimePickerSizes() {
  return (
    <div className="gap-ws-5 flex flex-wrap items-center justify-center">
      {(['sm', 'md', 'lg'] as const).map((size) => (
        <TimePicker
          key={size}
          className="w-[9rem]"
          size={size}
          aria-label="Start time"
          placeholder="Start time"
        />
      ))}
    </div>
  );
}

Formats

The format changes only the labels; the value is always HH:mm in 24-hour time, so the same data works in both. intervalInMinutes sets the step (15 by default), min and max bound the list, and mode="from" or "to" drops the last or the first time for the two ends of a range.

tsx
import { TimePicker } from '@/components/ui/wideset/timepicker/Timepicker';

export default function TimePickerFormats() {
  return (
    <div className="gap-ws-5 flex flex-wrap items-center justify-center">
      <TimePicker className="w-[10rem]" format="24h" aria-label="Start time" defaultValue="14:30" />
      <TimePicker className="w-[10rem]" format="12h" aria-label="Start time" defaultValue="14:30" />
    </div>
  );
}

States

Hover and focus are live. With clearable, a clear button appears once a time is picked; it is a separate control with its own label. Disabled removes the trigger from the tab order.

tsx
import { TimePicker } from '@/components/ui/wideset/timepicker/Timepicker';

export default function TimePickerStates() {
  return (
    <div className="gap-x-ws-7 gap-y-ws-5 grid grid-cols-[4rem_minmax(0,10rem)] items-center">
      <span className="typography-caption-md text-ws-static-subtle">Empty</span>
      <TimePicker aria-label="Start time" placeholder="Start time" />
      <span className="typography-caption-md text-ws-static-subtle">Picked</span>
      <TimePicker aria-label="Start time" defaultValue="09:00" clearable />
      <span className="typography-caption-md text-ws-static-subtle">Disabled</span>
      <TimePicker aria-label="Start time" defaultValue="09:00" disabled />
    </div>
  );
}

API reference

NameDescriptionDefault
children

Sub-components for composable usage (`Select.Trigger`, `Select.Content`, `Select.Option`, etc.). Use instead of `options` when you need grouped options, custom layouts, or full rendering control.

ReactNode
—
className

Additional CSS classes applied to the trigger element. Width utilities (e.g. `w-[20rem]`) override the default width.

string
—
clearable

Whether to show a clear button in the trigger when a value is selected.

boolean
—
clearSelectionAriaLabel

Accessible label for the clear-selection button. Defaults to `'Clear selection'`.

string
—
defaultMotion

Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`.

boolean
true
format

Display format for the time labels. Defaults to `24h`.

'12h''24h'
'24h'
hasSearch

Whether to show a search input at the top of the dropdown that filters options by label.

boolean
—
hideArrow

Whether to hide the dropdown arrow icon on the right side of the trigger.

boolean
—
id

HTML `id` attribute for the trigger element, useful for form label association.

string
—
intervalInMinutes

Minutes between consecutive time options. Defaults to `15`.

number
—
max

Latest time option in 24-hour `HH:mm` format. Defaults to `23:59`.

string
—
min

Earliest time option in 24-hour `HH:mm` format. Defaults to `00:00`.

string
—
mode

For `from`, excludes the last time option; for `to`, excludes the first. Omit to include all options.

'from''to'
—
name

HTML `name` attribute forwarded for form submission.

string
—
onClear

Called when the clear button is clicked. Use for custom reset logic beyond clearing the value.

(() => void)
—
placeholder

Placeholder text shown in the trigger when no option is selected.

string
—
preset

Visual style preset. `border` adds a visible border and background; `ghost` uses a transparent background.

'border''ghost'
—
size

Controls the height, padding, and typography size of the trigger.

'sm''md''lg'
—
variant

Color variant. `danger` applies error styling for form validation feedback.

'primary''danger'
—

Accessibility

  • Name it with id plus a label (FormField htmlFor) or aria-label; don’t rely on the placeholder.
  • The clear button is a separate control; clearSelectionAriaLabel sets its name.
  • For an invalid time, use variant="danger" with FormField errorText, which links the message.
tsx
import { TimePicker } from '@/components/ui/wideset/timepicker/Timepicker';

<TimePicker placeholder="Start time" defaultValue="09:00" />

Appearance

Variant
Style
Size
Hide arrow

Content

Format
Interval
Time picked

State

Disabled

Behavior

Clearable