DocsGitHub
Getting Started
  • Overview
  • Design Tokens
Components
  • Accordion
  • Alert
  • Announcement
  • Avatar
  • Badge
  • BigCalendar
  • Breadcrumb
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Checkbox
  • Chip
  • CloseButton
  • Combobox
  • CommandPalette
  • ContextMenu
  • Currency
  • DatePicker
  • DescriptionList
  • Drawer
  • DropdownMenu
  • EmptyState
  • Field
  • FileUpload
  • FormGrid
  • GanttChart
  • Hotkey
  • Icon
  • Input
  • Kanban
  • Metric
  • Modal
  • MultiSelect
  • NumberInput
  • Pagination
  • Popover
  • ProgressBar
  • Radio
  • Rating
  • SegmentedControl
  • Select
  • SelectionCard
  • Sidebar
  • Skeleton
  • Slider
  • Spinner
  • Stepper
  • Switch
  • Table
  • Tabs
  • Textarea
  • Timeline
  • TimePicker
  • Toast
  • Tooltip
  • TransferList
  • TreeView
  • Wizard
Charts
  • Overview
  • Area Chart
  • Bar Chart
  • Donut Chart
  • Line Chart
  • Pie Chart
  • Stacked Bar Chart

TimePicker

A keyboard-accessible 12-hour time field with an AM/PM chip-grid panel and free-form parsing.

Default

Type a 12-hour time (`9:30 pm`, `930am`, or 24h `1430`), or pick from the chip grid -- toggle AM/PM, choose an hour, then a minute. Clicking an hour keeps the panel open for the minute; clicking a minute commits and closes.

tsx
<TimePicker label="Start time" defaultValue="09:30 AM" />

Installation

tsx
import { TimePicker } from "madagent";

Controlled

The selected canonical value is 09:30 AM.

tsx
const [value, setValue] = useState("09:30 AM");

<TimePicker value={value} onChange={setValue} />

Sizes

tsx
<TimePicker size="sm" defaultValue="08:00 AM" />
<TimePicker size="md" defaultValue="09:30 AM" />
<TimePicker size="lg" defaultValue="11:00 AM" />

Step and constraints

Minute chips step by 15 within business hours. min/max disable out-of-range chips: an hour is disabled unless at least one of its minutes is allowed, and a meridiem is disabled when its whole half-day is out of range. Here 08 and 06 PM are unavailable, 09 allows :00/:15/:30/:45, and 05 PM only allows :00.

tsx
<TimePicker min="09:00 AM" max="05:00 PM" step={15} />

Disabled

tsx
<TimePicker value="02:00 PM" disabled />

API Reference

PropTypeDefaultDescription
value
string
-Controlled 12h value, e.g. "09:30 AM"
defaultValue
string
-Initial uncontrolled 12h value, e.g. "09:30 AM"
onChange
(value: string) => void
-Called with a canonical "hh:mm AM|PM" value
step
number
15Minutes between generated minute chips
min
string
-Earliest selectable 12h value, e.g. "08:00 AM"
max
string
-Latest selectable 12h value, e.g. "06:00 PM"
meridiemLabels
Partial<Record<"AM" | "PM", string>>
-Visible AM/PM option labels; canonical values stay unchanged
size
"sm""md""lg"
"md"Field size
label
string
-Visible field label
disabled
boolean
falseDisables typing and selection

RTL Support

Components automatically adapt to right-to-left languages using CSS logical properties.

Preview

Usage

tsx
<TimePicker
  label="وقت البدء"
  defaultValue="09:30 AM"
  meridiemLabels={{ AM: "صباحًا", PM: "مساءً" }}
/>