schedule

Timepicker

Pick a time with time selector UI.

TimePicker Examples

Copy-ready examples with live previews.

Controlled value (recommended)

The committed value is controlled by your state. Changes are emitted only on OK.

Live preview

Committed value: 09:30
timer

Note: onChange fires only when the user presses OK inside the picker.

Controlled value + clear / preset buttons

import { useState } from "react";
import TimePicker from "@/packages/ui/src/_components/timepicker/Timepicker";
import type { TimeValue } from "@/packages/ui/src/_components/timepicker/Timepicker.type";

export default function Example() {
  const [value, setValue] = useState<TimeValue | null>({ hour: 9, minute: 30 });

  return (
    <TimePicker
      label="Time"
      value={value}
      onChange={setValue}
    />
  );
}

Controlled open + layout / format

Drive the popover open state yourself and switch to 24h + horizontal panel.

Live preview

open: false | committed: null
timer

Controlled open

import { useState } from "react";
import TimePicker from "@/packages/ui/src/_components/timepicker/Timepicker";
import type { TimeValue } from "@/packages/ui/src/_components/timepicker/Timepicker.type";

export default function Example() {
  const [open, setOpen] = useState(false);
  const [value, setValue] = useState<TimeValue | null | undefined>(undefined);

  return (
    <TimePicker
      label="Schedule"
      open={open}
      onOpenChange={setOpen}
      value={value}
      onChange={setValue}
      format="24h"
      orientation="horizontal"
    />
  );
}

initialValue

Provide a default draft when the picker is first used.

Live preview

committed: null
timer

initialValue is used only when value is undefined on first render. Once controlled, updates come from value.

initialValue (value initially undefined)

import { useState } from "react";
import TimePicker from "@/packages/ui/src/_components/timepicker/Timepicker";
import type { TimeValue } from "@/packages/ui/src/_components/timepicker/Timepicker.type";

export default function Example() {
  const [value, setValue] = useState<TimeValue | null | undefined>(undefined);

  return (
    <TimePicker
      label="Starts at"
      value={value}
      onChange={setValue}
      initialValue={{ hour: 8, minute: 0 }}
    />
  );
}

Customize trigger input

Pass inputProps to the trigger input (placeholder, helper text, icons, etc.).

Live preview

timer

Press OK to commit

You can pass inputProps to customize the trigger input (excluding label/value/onChange/type).

inputProps

import { useState } from "react";
import TimePicker from "@/packages/ui/src/_components/timepicker/Timepicker";
import type { TimeValue } from "@/packages/ui/src/_components/timepicker/Timepicker.type";

export default function Example() {
  const [value, setValue] = useState<TimeValue | null>({ hour: 10, minute: 45 });

  return (
    <TimePicker
      label="Reminder"
      value={value}
      onChange={setValue}
      inputProps={{
        placeholder: "Pick a time",
        extraText: "Press OK to commit",
      }}
    />
  );
}

On this page

TimePicker Props

TimePicker — Props
PropTypeRequiredDefaultDescription
valueTimeValue | nullNoControlled value (recommended). When it changes, the internal draft syncs to it.
onChange(next: TimeValue | null) => voidNoCalled on OK with a normalized value, or null.
openbooleanNoControlled open state. If omitted, the component manages its own open state.
onOpenChange(open: boolean) => voidNoNotified on open/close actions. If open is uncontrolled, it also drives internal state.
labelstringNo"Time"Label shown in the trigger.
format"12h" | "24h"No"12h"Time format. In 12h, the UI supports AM/PM.
orientation"vertical" | "horizontal"No"vertical"Layout direction for the picker panel.
initialValueTimeValueNoInitial draft when value is not provided (first render only).
inputPropsOmit<IInputProps, "label" | "value" | "onChange" | "type">NoProps merged into the trigger input (excluding the listed keys).
classNamestringNoExtra className appended to the picker container root.
customStylesReact.CSSPropertiesNoInline styles applied to the picker container.