# Time picker

A controlled native time field with accessible help and error wiring plus a clear 12-hour or 24-hour display.

Access: pro. Category: Forms. Kind: primitive.

## When to use

- Use it when a product interface needs a controlled native time field with accessible help and error wiring plus a clear 12-hour or 24-hour display.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose form-field instead when a labeled email field with validation and help text is the actual interface need, rather than time picker.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Time picker

```sh
npx shadcn@latest add @tidal-pro/time-picker
```

Stylesheets: `components/ui/tidal.css`, `components/ui/time-picker.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/time-picker.css";
import{TidalTimePicker}from"./components/ui/time-picker";
export default()=><div className="tidal-scope"><TidalTimePicker label={"Demo"} onValueChange={() => {}} value={"value"}/></div>;
```

## Structured props

- `TidalTimePicker.label: ReactNode`: Required label value accepted by this exported component.
- `TidalTimePicker.onValueChange: (value: string) => void`: Callback invoked when the value change interaction is proposed.
- `TidalTimePicker.value: string`: Required value value accepted by this exported component.
- `TidalTimePicker.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalTimePicker.displayLabel?: ReactNode` (default "Selected time"): Optional display label value accepted by this exported component.
- `TidalTimePicker.emptyDisplay?: ReactNode` (default "No time selected"): Optional empty display value accepted by this exported component.
- `TidalTimePicker.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalTimePicker.hint?: ReactNode`: Optional hint value accepted by this exported component.
- `TidalTimePicker.hourCycle?: 12 | 24 | undefined` (default 12): Optional hour cycle value accepted by this exported component.
- `TidalTimePicker.inputProps?: NativeTimeInputProps | undefined`: Optional input props value accepted by this exported component.
- `TidalTimePicker.inputRef?: Ref<HTMLInputElement> | undefined`: Optional input ref value accepted by this exported component.
- `TidalTimePicker.readOnly?: boolean | undefined` (default false): Optional read only value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/time-picker.tsx) | [Manifest](https://tidalui.com/examples/time-picker.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useId, useState } from "react";

import { TidalTimePicker } from "./components/ui/time-picker";

import "./components/ui/time-picker.css";



const tidalExampleStyles = ".tidal-scope .time-picker-demo,\n.tidal-scope .time-picker-demo * {\n  box-sizing: border-box;\n}\n\n.tidal-scope .time-picker-demo {\n  container: tidal-time-demo / inline-size;\n  display: grid;\n  width: min(100%, 760px);\n  min-width: 0;\n  gap: 22px;\n  margin-inline: auto;\n  padding: clamp(16px, 4vw, 42px);\n  color: var(--t-ink);\n}\n\n.tidal-scope .time-picker-demo-heading {\n  display: grid;\n  min-width: 0;\n  gap: 8px;\n}\n\n.tidal-scope .time-picker-demo-heading :is(h2, p) {\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .time-picker-demo-heading h2 {\n  font-size: clamp(27px, 5vw, 42px);\n  font-weight: 570;\n  letter-spacing: -0.05em;\n  line-height: 1;\n}\n\n.tidal-scope .time-picker-demo-heading p,\n.tidal-scope .time-picker-demo-footer {\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.5;\n}\n\n.tidal-scope .time-picker-demo-form {\n  display: grid;\n  min-width: 0;\n  gap: 20px;\n  padding: clamp(16px, 4vw, 28px);\n  border: 1px solid var(--t-border);\n  border-radius: 18px;\n  background: var(--t-surface);\n}\n\n.tidal-scope .time-picker-demo-toolbar {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr);\n  min-width: 0;\n  gap: 12px;\n}\n\n.tidal-scope .time-picker-demo-toolbar fieldset {\n  display: flex;\n  flex-wrap: wrap;\n  min-width: 0;\n  gap: 6px;\n  margin: 0;\n  padding: 0;\n  border: 0;\n}\n\n.tidal-scope .time-picker-demo-toolbar legend {\n  width: 100%;\n  margin-bottom: 4px;\n  font-size: 11px;\n  font-weight: 650;\n}\n\n.tidal-scope .time-picker-demo-toolbar label {\n  position: relative;\n  display: inline-flex;\n  min-width: 0;\n}\n\n.tidal-scope .time-picker-demo-toolbar input {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  opacity: 0;\n}\n\n.tidal-scope .time-picker-demo-toolbar label span {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  min-width: 44px;\n  min-height: 44px;\n  padding: 8px 11px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  background: var(--t-surface);\n  font-size: 11px;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .time-picker-demo-toolbar input:checked + span {\n  border-color: var(--t-ink);\n  background: var(--t-ink);\n  color: var(--t-surface);\n}\n\n.tidal-scope .time-picker-demo-toolbar input:focus-visible + span {\n  outline: 2px solid var(--t-ink);\n  outline-offset: 3px;\n}\n\n.tidal-scope .time-picker-demo-actions {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 8px;\n}\n\n.tidal-scope .time-picker-demo-actions button {\n  min-width: 44px;\n  min-height: 44px;\n  padding: 0 14px;\n  border: 1px solid var(--t-ink);\n  border-radius: 10px;\n  background: var(--t-ink);\n  color: var(--t-surface);\n  font: inherit;\n  font-size: 11px;\n  font-weight: 650;\n}\n\n.tidal-scope .time-picker-demo-actions button[type=\"reset\"] {\n  border-color: var(--t-border);\n  background: var(--t-surface);\n  color: var(--t-ink);\n}\n\n.tidal-scope .time-picker-demo-actions button:focus-visible {\n  outline: 2px solid var(--t-ink);\n  outline-offset: 3px;\n}\n\n.tidal-scope .time-picker-demo-footer {\n  display: grid;\n  min-width: 0;\n  gap: 4px;\n}\n\n.tidal-scope .time-picker-demo-footer :is(p, span) {\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n@container tidal-time-demo (max-width: 500px) {\n  .tidal-scope .time-picker-demo-toolbar {\n    grid-template-columns: minmax(0, 1fr);\n  }\n\n  .tidal-scope .time-picker-demo-actions button {\n    flex: 1 1 120px;\n  }\n}\n\n@media (pointer: coarse) {\n  .tidal-scope .time-picker-demo-toolbar label span,\n  .tidal-scope .time-picker-demo-actions button {\n    font-size: 16px;\n  }\n}";

type FieldMode = "editable" | "readonly" | "disabled";

const INITIAL_TIME = "09:30";

export function TimePickerDemo() {
  const demoId = useId().replace(/:/g, "");
  const headingId = `${demoId}-daily-review`;
  const [value, setValue] = useState(INITIAL_TIME);
  const [hourCycle, setHourCycle] = useState<12 | 24>(12);
  const [mode, setMode] = useState<FieldMode>("editable");
  const [status, setStatus] = useState("Choose a local review time.");

  return (
    <section className="time-picker-demo" aria-labelledby={headingId}>
      <header className="time-picker-demo-heading">
        <h2 id={headingId}>Daily review</h2>
        <p>Choose a time and review it in 12-hour or 24-hour format.</p>
      </header>

      <form
        className="time-picker-demo-form"
        action="/local-time-preview"
        method="post"
        onSubmit={(event) => {
          event.preventDefault();
          const submittedValue = new FormData(event.currentTarget).get(
            "reviewTime",
          );
          setStatus(
            typeof submittedValue === "string" && submittedValue
              ? `Local preview prepared for ${submittedValue}.`
              : "The disabled field was not included in the local preview.",
          );
        }}
        onReset={() => {
          setValue(INITIAL_TIME);
          setHourCycle(12);
          setMode("editable");
          setStatus("The local sample was reset.");
        }}
      >
        <div className="time-picker-demo-toolbar">
          <fieldset>
            <legend>Field state</legend>
            {(["editable", "readonly", "disabled"] as const).map((option) => (
              <label key={option}>
                <input
                  type="radio"
                  name={`${demoId}-field-mode`}
                  value={option}
                  checked={mode === option}
                  onChange={() => setMode(option)}
                />
                <span>
                  {option === "readonly"
                    ? "Read only"
                    : option[0].toUpperCase() + option.slice(1)}
                </span>
              </label>
            ))}
          </fieldset>
          <fieldset>
            <legend>Display</legend>
            {([12, 24] as const).map((option) => (
              <label key={option}>
                <input
                  type="radio"
                  name={`${demoId}-hour-cycle`}
                  value={option}
                  checked={hourCycle === option}
                  onChange={() => setHourCycle(option)}
                />
                <span>{option}-hour</span>
              </label>
            ))}
          </fieldset>
        </div>

        <TidalTimePicker
          label="Review time"
          value={value}
          onValueChange={(nextValue) => {
            setValue(nextValue);
            setStatus("The local time value changed.");
          }}
          hourCycle={hourCycle}
          readOnly={mode === "readonly"}
          disabled={mode === "disabled"}
          hint="Uses the time value shown by this field. No time zone is applied."
          inputProps={{
            name: "reviewTime",
            required: true,
            min: "00:00",
            step: 300,
          }}
        />

        <div className="time-picker-demo-actions">
          <button type="submit">Prepare preview</button>
          <button type="reset">Reset</button>
        </div>
      </form>

      <footer className="time-picker-demo-footer">
        <p role="status" aria-live="polite">
          {status}
        </p>
        <span>Local sample only. Nothing is scheduled or saved.</span>
      </footer>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <TimePickerDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

label, controlled native HH:mm or optional second/fraction value and onValueChange are required. The component renders a labelled native type=time input and a non-submitting output display. Optional 12-hour or 24-hour display formatting preserves supplied second precision and does not apply a date, locale, time zone, recurrence or schedule rule. Native input name/form/min/max/step/required/autocomplete attributes and ref pass through while controlled type/value/defaultValue, disabled/readOnly, aria-disabled/aria-readonly and ARIA error state remain owned. The native onChange handler runs first and a prevented event suppresses the higher callback. Disabled and readOnly suppress mutation; disabled uses native disabled behavior. Optional hint, error, displayLabel, emptyDisplay and root div attributes/ref remain consumer-owned, with nullish ReactNode values preserved and linked descriptions/errors. Consumers own validation, form submission, reset and every outcome. The component performs no scheduling, date conversion, request, network, storage or backend action.
