Components
Date & Time
Time Picker

Time Picker

A time-only input for scheduling and time selection workflows. Renders a scrollable hour/minute selector in a popover. Supports 12-hour/24-hour formats, configurable minute step, min/max time boundaries, label, and helper text.

Installation

1. Copy the source code:

  • Source: packages/ui/src/common/data-input/dates/time-picker.tsx
  • Place in your project: components/common/data-input/dates/time-picker.tsx

2. Install dependencies:

npm install date-fns

3. Update the import paths to match your project structure.


Usage

import { TimePicker } from "@hoag/ui/time-picker";
 
export default function Demo() {
  const [time, setTime] = React.useState("08:30");
  return <TimePicker value={time} onChange={setTime} />;
}

Default

<TimePicker value="08:30" onChange={setTime} />

24-hour vs 12-hour Format

{
  /* 24-hour (default) */
}
<TimePicker value="14:30" onChange={setTime} />;
 
{
  /* 12-hour format */
}
<TimePicker use12HourFormat value="14:30" onChange={setTime} />;

With Label and Helper Text

<TimePicker
  label="Giờ bắt đầu"
  helperText="Chọn giờ làm việc (8:00 - 18:00)"
  value="08:00"
  onChange={setTime}
/>

Minute Step

Dùng minuteStep để chỉ hiển thị các mốc phút theo bước nhảy nhất định.

<TimePicker minuteStep={15} value="09:00" onChange={setTime} />

Disabled

<TimePicker value="08:30" disabled onChange={setTime} />

API Reference

<TimePicker>

PropTypeDefaultDescription
valuestringControlled time in HH:mm format (24-hour)
onChange(time: string) => voidCallback when time changes (required)
use12HourFormatbooleanfalseRender 12-hour format with AM/PM
minuteStepnumber1Minute interval step (e.g. 15 → 0, 15, 30, 45)
labelstringInput label text
placeholderstringInput placeholder
helperTextstringHelper text displayed below the input
size"default" | "lg""default"Input size variant
errorbooleanfalseError state
disabledbooleanfalseDisable the picker
minDateMinimum selectable time
maxDateMaximum selectable time
hasRemoveIconbooleantrueShow remove icon when a value is selected
onClearValue() => voidCallback when clear/remove button is clicked
modalbooleanfalseRender popover as modal
classNamestringCustom CSS class

MIT 2026 © @hoag/ui