← Home v1.5.0

Docs / Components / Time picker

Time picker

Turns a real <input type="time"> into a field you can type into or pick from a list: step, min and max, overnight ranges, 12- or 24-hour display. Submits HH:MM like a normal field, works without JavaScript, keyboard accessible.

Time picker New

A time field people can type into or pick from a list. Put data-ace-timepicker on a real <input type="time"> and add ace-timepicker.js. The native input stays in the form and holds the value as HH:MM (24-hour), so it submits like any field, and without the script the browser's own time field still works with the same min, max and step. Typed times are understood loosely (14:30, 1430, 2:30 pm, 9), snap to the nearest step, and anything outside min / max is refused.

Every 15 minutes, 08:00 to 20:00.

Choose a return time.

<div class="ace-field">
  <label class="ace-label" for="pickup-time">Pick-up time</label>
  <input type="time" class="ace-input" id="pickup-time" name="pickup_time"
         data-ace-timepicker min="08:00" max="20:00" step="900" value="10:00">
</div>

From the input:  value · min / max (HH:MM; min > max = overnight, e.g. 22:00 → 02:00)
                 step in seconds, as in HTML (900 = every 15 min; no step = list every 30 min)
                 disabled · required · aria-invalid="true" · aria-describedby
Options:         data-clock="12h" | "24h" (default: from the locale) · data-locale="de"
                 data-placeholder · data-toggle-label (translations)

Keyboard, events and code

The field is an ARIA combobox with a listbox of times; focus stays in the field. ↓ / ↑ open the list and move through it, Page Up / Page Down jump six, Home / End go to the first and last time, typing highlights the first matching time, Enter picks it, and Esc closes the list and undoes what was typed. Every change fires input, change and ace:change on the input.

Value: none yet

input.addEventListener('ace:change', e => console.log(e.detail))   // → { value: '14:00' }

input.aceTimepicker.setValue('09:30')   // no events
input.aceTimepicker.refresh()           // after changing min, max, step or disabled from code
input.aceTimepicker.open()              // .close(), .getValue(), .control (the visible field)

// Markup added after page load (Vue / React / HTMX):
AceTimePicker.init(container)
Do
  • Set a step for bookings and appointments (900 for every 15 minutes), so the list stays short and every time is one you can honour.
  • Put class="ace-input" on the native input too: without the script, the browser's own field still looks like AceCSS.
  • Use data-clock when the site's audience expects one format whatever the browser language.
Don't
  • Add a second picker for the same value next to it; for pick-up and return dates with times, use the date range picker, which has its own time fields.
  • Rely on step below a minute: seconds are not shown, so the field works in whole minutes.

Use it

One stylesheet and one script from the CDN, pinned to v1.5.0:

<link rel="stylesheet" href="https://acecss.dev/v1.5.0/ace.min.css"
      integrity="sha384-WmkeAiD0DT0GfPo6Dp2l/XBsGQEN1+Fo/7i+QMs/3UfKE/xCswJsjpBxwKYYSMCR" crossorigin="anonymous">
<script src="https://acecss.dev/v1.5.0/ace-timepicker.min.js" defer
        integrity="sha384-tOWkCMrWgw1xEMmB6aAaBzwRz9aTluorO9wCSld3vo/93bCkeGsCzzI5lXysnWi1" crossorigin="anonymous"></script>

Or from npm:

npm i @acecss/core

import '@acecss/core'
import '@acecss/core/timepicker'

Bundlers, Tailwind, every script in one file and self-hosting: Install.

More components

ButtonsCopy-paste CSS buttons with primary, secondary and danger styles, five colours, any brand colour via one variable, four sizes, icon buttons and a loading state. Dark mode built in, no JavaScript.View component
Glass buttonsButtons v2: frosted glass pill buttons with a lit rim and soft layered shadow, plus a brand-coloured glass pill with a glow. Three sizes, icon buttons, a flat Coming soon state, dark mode built in, no JavaScript.View component
Hero buttonA sparkle call-to-action button for landing pages: a dark pill that turns brand-coloured on hover, with twinkling stars, a spark line round the edge and particles. No GSAP, respects reduced motion.View component
NavbarA sticky floating glass navbar: blurred, tinted pill with a sliding hover highlight, a raised shadow on scroll and a mobile menu that unfolds inside the pill. Framework-free, dark mode included.View component
Liquid navbarA liquid-glass navbar that refracts the real page behind it: a WebGL lens magnifies, bends content in at the rim with a colour fringe, frosts and lights the glass. Drop-in HTML, no framework.View component
CardsCards in two layers: a tinted shell holding a raised media panel, then a title, text and one glass action. Only the media and the action are links, one tab stop per card, actions lined up across a row. Dark mode built in, no JavaScript.View component
Segmented controlA segmented control for switching views or options: a row of AceCSS buttons with aria-pressed, in three sizes and a full-width variant. Accessible, dark-mode ready, no JavaScript needed for the styles.View component
InputsAccessible CSS text inputs with labels, hints, required markers and error states, plus inputs with icons, prefixes and suffixes. Works with plain HTML forms and any framework.View component
Select & dropdownStyle native selects and textareas, or turn any <select> into a searchable dropdown with sub-labels and option groups. About 3 KB of JavaScript, keyboard accessible, no dependencies.View component
Date pickerA dependency-free date picker and pick-up → return date range picker that shows two months side by side, with times, min and max dates, locales and a change event. Dates can be typed or picked. About 5 KB of JavaScript, dark mode ready.View component
Checkbox, radio & switchStyled native checkboxes, radio buttons and toggle switches in pure CSS: accessible labels, focus rings and dark mode, with no JavaScript.View component
BadgesStatus badges in pure CSS: neutral, primary, success, warning, danger and info, in two sizes, with contrast checked for white text.View component
Choice cardsSelectable cards for plans, extras or options: built on AceCSS buttons, selected with a class, aria-pressed or a checked radio inside. Pure CSS, accessible, dark mode ready.View component