Skip to the page content

Time pickers

Time fields as a clock face, a scroll wheel, typed entry, ranges, durations and weekly hours.

8 pickers

Typed time with popover

A text field that reads times the way people type them, with a button that opens an hour and minute grid. Use it on desktop forms where typing is fastest. It parses loose input, checks a min and max, switches 12/24-hour and stores 24-hour.

Typed entry
Clock format
Try 930, 7.15pm, noon or 18:45. Visits run from 9:00 AM to 8:00 PM.

Stored as 18:30

Show code
readTyped('930')     // 09:30
readTyped('7.15pm')  // 19:15
readTyped('noon')    // 12:00
readTyped('25:00')   // null, shows the error
<input type="text" aria-describedby="help err" data-tp-typed-input>
<div role="dialog" data-tp-typed-pop hidden>…</div>

Analog clock picker

A 12-hour dial for picking an hour, then a minute. Use it on touch screens where tapping a face is quicker than typing. Tap or drag round the face; the arrow keys and Enter work too.

Clock face
Morning or afternoon

We'll nudge you at 7:30 AM on weekdays.

Show code
<div class="tp-clock" data-tp-clock data-value="07:30">
  <button class="tp-clock-seg" data-tp-clock-mode="hour" aria-pressed="true">…</button>
  <button class="tp-clock-seg" data-tp-clock-mode="minute">…</button>
  <div class="tp-clock-dial" role="slider" tabindex="0" data-tp-clock-dial>
    <svg>…hand…</svg>
    <div class="tp-clock-nums" data-tp-clock-nums></div>
  </div>
</div>
// Picking an hour moves on to minutes. Enter does the same from the keyboard.

Scroll wheel picker

Hour, minute and AM/PM on snapping wheels, like a phone alarm. Good for compact panels on touch devices. Scroll or click a value, or focus a wheel and use the arrow keys, Home and End. Minutes move in 5-minute steps.

Scroll wheel

Last order before

2:30 PM

Stored as 14:30.

Show code
<div class="tp-wheel" data-tp-wheel data-value="14:30">
  <div class="tp-wheel-col" data-tp-wheel-col="hour"   role="group" tabindex="0"></div>
  <div class="tp-wheel-col" data-tp-wheel-col="minute" role="group" tabindex="0"></div>
  <div class="tp-wheel-col" data-tp-wheel-col="ap"     role="group" tabindex="0"></div>
</div>
.tp-wheel-col { scroll-snap-type: y mandatory; }
// Minutes move in 5-minute steps. The value is kept as 24-hour "14:30".

Duration stepper

A length of time rather than a time of day, set in hours and minutes with steppers or common lengths. Minutes step by 15, and anything under a minimum length shows an error.

Duration
Visit length
Show code
<div class="basalt-stepper" data-basalt-stepper>
  <button class="basalt-stepper-btn" data-basalt-step="-1">…</button>
  <input type="number" class="basalt-stepper-input" min="0" max="45" step="15">
  <button class="basalt-stepper-btn" data-basalt-step="1">…</button>
</div>
// basalt.js fires 'change' on the input after every step.

Time range slider

Two handles on one track set a start and an end within fixed day limits. Use it for windows and shifts. It keeps a minimum length, snaps to 30 minutes, and the arrow keys and Page Up / Page Down move a focused handle.

Range

Tomorrow, Tuesday

10:00 AM to 1:00 PM

3 hour window Free delivery
earliest
latest

Windows shorter than 3 hours cost $3.50. The shortest is 2 hours.

Show code
<div class="tp-window" data-tp-window
     data-start="07:00" data-end="21:00"   <!-- the day's limits -->
     data-from="10:00" data-to="13:00"     <!-- starting window -->
     data-min="2">                         <!-- shortest window, hours -->
  <div class="tp-window-track" data-tp-win-track>
    <div class="tp-window-fill" data-tp-win-fill></div>
    <button role="slider" data-tp-win-thumb="from" aria-label="Earliest"></button>
    <button role="slider" data-tp-win-thumb="to" aria-label="Latest"></button>
  </div>
</div>
// Arrows move 30 minutes, Page Up / Page Down move 2 hours.

Time slot grid

A radio group of fixed slots, grouped by part of the day, with a day switcher above. Use it when only certain times can be booked. Full slots stay visible but disabled, past times drop out, and submitting without a pick shows an error.

Slot grid
Day

Your pickup

No slot chosen yet

14 Moorings Street

We hold orders for 2 days

Show code
<fieldset>
  <legend>Morning</legend>
  <label class="tp-slot">
    <input type="radio" name="pickup" value="09:15"><span>9:15</span>
  </label>
  <label class="tp-slot is-full">
    <input type="radio" name="pickup" value="09:30" disabled><span>9:30</span>
  </label>
</fieldset>
// One radio group per day, so the arrow keys skip the full slots.

Weekly hours editor

One open and close pair per day, each with a switch to mark the day closed. Use it for opening or delivery hours. Copy one day to the others, see the weekly total, and saving checks every row for a close time after the open time.

Weekly hours

Show code
<fieldset class="tp-week-row">
  <legend>Monday</legend>
  <input type="checkbox" role="switch" id="mon-open" checked>
  <select id="mon-from" aria-describedby="mon-err">…</select>
  <select id="mon-to" aria-describedby="mon-err">…</select>
  <p id="mon-err" class="tp-invalid-text"></p>
</fieldset>

Native time input

The browser's own type="time" field with min, max and a 15-minute step. Use it when you want zero JavaScript and the platform's picker. The value is always 24-hour, and the browser flags out-of-range and off-step times.

Native
Between 6:00 AM and noon.
At least an hour after the earliest.

value "07:00" to "09:30"

Show code
<input type="time" id="from" value="07:00"
       min="06:00" max="12:00" step="900" required
       aria-describedby="from-help from-err">
input.validity.rangeOverflow  // later than max
input.validity.stepMismatch   // not on a 15-minute mark