npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-time-picker.json --yesTime picker
ProA field for a time of day that a person types or picks from a list, such as a meeting's start, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- TimeRangePickerA start and an end time of one day
import { TimePicker, TimeRangePicker } from '@/components/ui/goop/time-picker';
import { DatePicker, DatePickerTrigger, DatePickerValue, DatePickerContent, DatePickerPanel } from '@/components/ui/goop/date-picker';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
<form>
<div role="group" aria-label="Starts" className="flex gap-2">
<DatePicker name="day">
<DatePickerTrigger asChild>
<Button variant="outline" shape="rounded" size="lg" className="min-w-0 flex-1 justify-start">
<DatePickerValue placeholder="Date" />
</Button>
</DatePickerTrigger>
<DatePickerContent aria-label="Date">
<DatePickerPanel />
</DatePickerContent>
</DatePicker>
<TimePicker aria-label="Time" name="time" step={30} className="w-26 shrink-0" />
</div>
<TimeRangePicker
aria-label="Meeting"
name="meeting"
defaultValue={{ from: '09:00', to: '10:30' }}
step={30}
min="08:00"
max="20:00"
/>
<Field label="Reminder" orientation="vertical">
<TimePicker
name="reminder"
hourCycle={12}
locale="en-US"
error="Type a time such as 9:30 AM."
/>
</Field>
</form>Type a time in any common way ("9", "930", "9:30pm") and leave the field, or pick one from the list; set a meeting’s start and end (an end before the start is refused, the end list says each length); each time chosen, and a list open, is said under the fields; Save shows the 24-hour times the form sends. Nothing is booked: Save only reads the form.
When to use
- A field for a time of day that a person types or picks from a list, such as a meeting's start.
- Also called: time input.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Time picker on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-time-picker.json --yesAdd the Goop Time picker to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { TimePicker, TimeRangePicker } from '@/components/ui/goop/time-picker';
import { DatePicker, DatePickerTrigger, DatePickerValue, DatePickerContent, DatePickerPanel } from '@/components/ui/goop/date-picker';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
<form>
<div role="group" aria-label="Starts" className="flex gap-2">
<DatePicker name="day">
<DatePickerTrigger asChild>
<Button variant="outline" shape="rounded" size="lg" className="min-w-0 flex-1 justify-start">
<DatePickerValue placeholder="Date" />
</Button>
</DatePickerTrigger>
<DatePickerContent aria-label="Date">
<DatePickerPanel />
</DatePickerContent>
</DatePicker>
<TimePicker aria-label="Time" name="time" step={30} className="w-26 shrink-0" />
</div>
<TimeRangePicker
aria-label="Meeting"
name="meeting"
defaultValue={{ from: '09:00', to: '10:30' }}
step={30}
min="08:00"
max="20:00"
/>
<Field label="Reminder" orientation="vertical">
<TimePicker
name="reminder"
hourCycle={12}
locale="en-US"
error="Type a time such as 9:30 AM."
/>
</Field>
</form>- Fits: flow, schedule (their recipes).
- Also known as: Input type="time", TimeField, TimeInput, TimeSelect, TimeRange.
- Put a TimePicker beside a DatePicker in one row for a date and a time (a
role="group"named once round the two, the time fieldw-26, the date trigger the rest), or a TimeRangePicker for a start and an end; setstep,minandmaxto the hours the page allows. - height, width, padding, gap, text: add no class for these.
API reference
- Each option with its sentence: time-picker--options.md
- State: value (value / defaultValue / onValueChange); open (open / defaultOpen / onOpenChange)
| Part | What it is |
|---|---|
| TimeRangePicker | A start and an end time of one day; its props: time-picker--time-range-picker.md |
- data-slot values (to select a part by): time-picker, time-picker-field, time-picker-input, time-picker-length, time-picker-value, time-range-picker, time-range-picker-dash
TimePicker: every option
import { TimePicker } from '@/components/ui/goop/time-picker';Options
- value?: string | null — The chosen time as 24-hour
HH:MM, when the caller holds it (nullfor none). - defaultValue?: string — The time chosen at first (
HH:MM), when the picker holds it. - onValueChange?: (value: string | null) => void — Called with the time chosen or typed (
HH:MM), ornullwhen it is cleared. - hourCycle?: 12 | 24 — The clock: 12 ("9:30 AM") or 24 ("09:30"); the language's if left out.
- locale?: string — The language of the times (a BCP 47 tag); the page's, else the browser's, if left out.
- step?: number — The minutes between the list's times, 15 if left out; a typed time off the step is kept.
- min?: string — The earliest time (
HH:MM): the list starts there and an earlier typed time is refused. - max?: string — The latest time (
HH:MM): the list ends there and a later typed time is refused. - placeholder?: string — The words shown while no time is chosen.
- name?: string — The form field's name: the chosen time is sent as
HH:MM. - open?: boolean — Whether the list is open, when the caller holds it; with
onOpenChange. - defaultOpen?: boolean — Whether the list is open at first.
- onOpenChange?: (open: boolean) => void — Called as the list opens and closes.
- error?: ReactNode — The error line under the field while what was typed is refused.
- clearLabel?: string — The clear button's spoken name.
- container?: HTMLElement | null — Where the list is drawn; the end of
<body>when left out. - Also takes: onChange?: (event: ChangeEvent<HTMLInputElement>) => void; required?: boolean; disabled?: boolean; form?: string
- State: value (value / defaultValue / onValueChange); open (open / defaultOpen / onOpenChange)
TimeRangePicker
A start and an end time of one day.
import { TimeRangePicker } from '@/components/ui/goop/time-picker';Options
- value?: TimeRange — The chosen range, when the caller holds it; with
onValueChange. - defaultValue?: TimeRange — The range chosen at first, when the picker holds it.
- onValueChange?: (value: TimeRange) => void — Called with the range after each change of either end.
- name?: string — The form fields' name: hidden fields send
<name>-fromand<name>-toasHH:MM. - fromLabel?: string = 'Start time' — The start field's spoken name.
- toLabel?: string = 'End time' — The end field's spoken name.
- fromPlaceholder?: string = 'Start' — The start field's placeholder.
- toPlaceholder?: string = 'End' — The end field's placeholder.
- orderMessage?: ReactNode = 'The end time must be after the start time.' — The sentence under the end field while the end is at or before the start.
- Types: TimeRange = { from?: string; to?: string }
Keyboard
| Key | What it does |
|---|---|
| ArrowDown Alt+ArrowDown | Open the list of times, the chosen one (else the one nearest now) highlighted; open, move the highlight down |
| ArrowUp | Open the list; open, move the highlight up (Alt+ArrowUp closes it) |
| PageUp PageDown | Move the highlight five times up or down |
| Home End | With the list open, move the highlight to the first or the last time |
| Enter | Take the highlighted time, or read the typed words, and close the list |
| Escape | Close the list; a second Escape puts the last good time back in the field |
| Tab | Read the typed words and move on; the focus never enters the list |
Accessibility
- The native element answers the keyboard.
- hover, focus-visible: the browser's own (:hover, :focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| disabled | the prop disabled |
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.