---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Time picker

A 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.

Pro. Its export: `TimePicker`.

## Try it

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.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-time-picker.json --yes
```

```text
Add the Goop Time picker to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
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 field `w-26`, the date trigger the rest), or a TimeRangePicker for a start and an end; set `step`, `min` and `max` to the hours the page allows.
- height, width, padding, gap, text: add no class for these.

## API reference

### Parts

- `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

```tsx
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 (`null` for 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`), or `null` when 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.

```tsx
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>-from` and `<name>-to` as `HH: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

- 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
- 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.

## Related

- [Date picker](/themes/trail/components/date-picker): A field that opens a calendar to choose one date, typed or picked.
- [Button](/themes/trail/components/button): A button with words that runs an action, in several looks and sizes.
- [Field](/themes/trail/components/field): A form row that ties one control to its label, its description and its error line, as a settings row or a stacked form field.
- [Wizard](/themes/trail/components/wizard): A flow the user goes through one step at a time, with back and next buttons.
