npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-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';
function VisitTimes({ onStart }: { onStart: (time: string | null) => void }) {
return (
<div className="flex flex-col gap-3">
<TimePicker
aria-label="Visit start"
name="start"
min="07:00"
max="18:00"
defaultValue="09:30"
onValueChange={onStart}
/>
<div className="flex items-center gap-1 text-base">
Crew meets at <TimePicker variant="inline" aria-label="Meeting time" defaultValue="08:15" />
</div>
<TimeRangePicker name="shift" defaultValue={{ from: '09:00', to: '12:30' }} />
</div>
);
}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>/meadow-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';
function VisitTimes({ onStart }: { onStart: (time: string | null) => void }) {
return (
<div className="flex flex-col gap-3">
<TimePicker
aria-label="Visit start"
name="start"
min="07:00"
max="18:00"
defaultValue="09:30"
onValueChange={onStart}
/>
<div className="flex items-center gap-1 text-base">
Crew meets at <TimePicker variant="inline" aria-label="Meeting time" defaultValue="08:15" />
</div>
<TimeRangePicker name="shift" defaultValue={{ from: '09:00', to: '12:30' }} />
</div>
);
}- 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), or a TimeRangePicker for a start and an end; setstep,minandmaxto the hours the page allows. In a line of words (a record's times) usevariant="inline". - height, width, padding, gap, corner, background, text, motion: 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); drawn by data-focus-visible, data-selected=true
| 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-error, 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
HH:MMon a 24-hour clock, when the caller holds it (nullfor none); withonValueChange. - 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 the field and the list are written on: 12 ("9:30 AM") or 24 ("09:30"); the language's if left out.
- locale?: string — The language the times are written and read in (a BCP 47 tag); the page's (
<html lang>), else the browser's, if left out. - step?: number — The minutes between the times in the list, 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: a hidden field sends the chosen time as
HH:MM(empty while none is chosen). - 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 sentence shown under the field, in the danger colour, while what was typed is refused (no time, or one outside
min–max) or the field is marked invalid. - clearLabel?: string — The clear button's spoken name (the filled field's; the inline field is emptied by the keys).
- container?: HTMLElement | null — Where the list is drawn; the end of
<body>when left out. - variant?: 'filled' | 'inline' — The field's look:
filled(the default) the theme's text field with a clear button, as wide as its caller;inlinethe compact field with no fill or edge, 13 px words, 7.3 figures wide at least, for a line of words. - Also takes: onChange?: (event: ChangeEvent<HTMLInputElement>) => void; required?: boolean; disabled?: boolean; form?: string
- State: value (value / defaultValue / onValueChange); open (open / defaultOpen / onOpenChange); drawn by data-focus-visible, data-selected=true
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 (no range runs past midnight).
- 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 |
| typing | Open the list, the highlight on the time nearest the words typed |
| 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: the browser's own (:hover): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| focus-visible | the attribute data-focus-visible |
| selected | the attribute data-selected=true |
| disabled | the prop disabled |
| invalid | the attribute aria-invalid |
Motion
- The part sets its own motion: add no transition or animation of your own.
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.