Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Inputs

TimePicker

Pick a time from a list you can type to filter (MUI X's TimePicker). ref points at the text box.

import { TimePicker } from "@stylhero/ui";

Example

Code
import { TimePicker } from "@stylhero/ui";

function TimePickerExample() {
  return <TimePicker label="Pickup time" min="09:00" max="18:00" step={30} />;
}

Props

PropTypeDefaultDescription
className string -
defaultValue string | null -
disabled boolean -
error ReactNode -
hint ReactNode - Help text under the field. Replaced by error when set.
id string -
label ReactNode -
locale string -
max string "23:59"
min string "00:00" "HH:mm" bounds, e.g. opening hours.
name string -
onBlur FocusEventHandler<HTMLInputElement> - Runs when the field loses focus (react-hook-form's field.onBlur).
onValueChange (time: string | null) => void -
placeholder string "Pick a time"
step number 30 Minutes between options.
value string | null - "HH:mm", 24-hour.

Takes a ref.

Keyboard

KeyDoes
TypingFilters the times
ArrowDown / ArrowUpMove through the times
EnterPicks the highlighted time
EscCloses the list

Accessibility

  • A Combobox of times, so it follows the same pattern.
  • The label, hint and error are linked to the control (aria-describedby), and error sets aria-invalid.

Generated from src/components/DatePicker.tsx. Something wrong or missing? Open an issue.