cnippet/ui
  1. ui
  2. pickers
  3. time picker

pickers

Time Picker

Pick a time from a list of slots with step, min and max limits, 12- or 24-hour display and blocked times. Copy-paste ready.

Installation

Usage

Good to know

  • Values are "HH:mm" strings in 24-hour time, the same format as <input type="time">, whatever hourCycle shows. That keeps them easy to compare, store and send.
  • Options run every step minutes from min to max, both included.
  • isTimeDisabled keeps a time visible but unpickable, which suits booked slots better than hiding them.
  • It's a Select underneath, so typing a number jumps to the matching time and arrow keys move through the list.
  • Pass name to submit the value with a form.
  • formatTime(value, hourCycle) and getTimeSlots(step, min, max) are exported for showing a picked time elsewhere, as the booking example's button does.

API Reference

TimePicker

Other props, such as id and className, go on the trigger button.

Examples

Start and end

Two pickers in 15-minute steps. The end list starts after the chosen start time, and the duration updates as you pick.

24-hour

Hourly quiet-hours settings in 24-hour time, disabled while the switch is off.