Start here
  • InstallationAdd Nelumbo to a shadcn project
  • ThemingBrand accent, neutrals, dynamic color
  • Biology componentsSequences, maps, plates and trees
  • katalyx.bio

    Time Picker

    Type a time into the field, or open the clock under it. The value is always a 24-hour "HH:mm" string, whatever the display, so it travels through forms and APIs unchanged.

    Install

    npx shadcn@latest add @nelumbo/time-picker

    Field

    Type in the locale's format. In 12-hour, “930p” and “9:30 pm” both become 9:30 PM; the colon and day period fill themselves in. A wrong time is flagged when you leave the field. The clock button, or Alt+↓, opens the picker.

    h:mm AM

    h:mm AM

    h:mm AM

    Choose a time.

    Start time value: 09:30

    The picker

    Large hour and minute chips choose which part you're editing. Drag the hand or press a number; after the hour, the dial moves on to minutes. What you pick is a draft until OK. Arrow keys change the focused chip, digits can be typed, Enter confirms.

    h:mm AM

    HH:mm

    24-hour locales

    The locale decides the format. The 24-hour dial has two rings: 1 to 12 outside, 13 to 00 inside. Override with hourCycle.

    HH:mm

    HH:mm

    Step, min and max

    Only times on the step are allowed, counted from min. The dial greys out hours and minutes that aren't, and the hand snaps to the nearest allowed one. Typing an unavailable time says why.

    Every 15 minutes, 9 AM to 5 PM.

    Alle 30 Minuten, 06:00 bis 22:00.

    List mode

    For dense UIs: scrollable hour and minute columns (and AM/PM) instead of the dial. Each column is a listbox with arrow keys.

    h:mm AM

    HH:mm

    Usage

    import { TimePicker } from "@/components/ui/time-picker"​<TimePicker label="Start time" value={time} onValueChange={setTime} />   // "09:30" or null<TimePicker label="Abflug" locale="de-DE" />                              // 24-hour<TimePicker label="Appointment" step={15} min="09:00" max="17:00" /><TimePicker label="Check-in" mode="list" name="checkin" />               // submits "15:00"

    Props

    PropTypeDefaultNotes
    value / defaultValuestring | null24-hour "HH:mm"
    onValueChange(value: string | null) => voidFires when a typed time is complete and allowed, and on OK
    min / maxstringEarliest and latest time, "HH:mm"
    stepnumber1Minutes between allowed times, counted from min
    localestring"en-US"Decides 12 or 24 hour, and the AM/PM labels
    hourCycle"h11" | "h12" | "h23" | "h24"Overrides the locale
    mode"dial" | "list""dial"The picker's layout
    namestringSubmits "HH:mm" through a hidden input
    label, variant, size, icon, description, errorAs on Input
    required / disabledboolean