Time Picker

Material Design 3 time picker web component (lit-material-time-picker).

  • 4.0 KB gzipped
  • @lit-material/time-picker 0.0.4
  • Renders on the server

Example

Install

npm install @lit-material/time-picker @lit-material/tokens
import "@lit-material/time-picker";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-time-picker>

Material Design 3 time picker — a clock-dial dialog, built on the native <dialog> element like lit-material-dialog (scrim, Escape-to-close, focus trap all come from the browser). No prior pattern in this repo to build on — the dial is a fresh design, the most novel interaction of any component here.

Properties

PropertyAttributeTypeDefaultDescription
openopenbooleanfalse
valuevaluestring | undefinednoneThe confirmed time, as a 24-hour "HH:MM" string (e.g. "14:05").
hourCyclehour-cycleTimePickerHourCycle"12"
labellabelstring"Select time"

Events

EventDescription
closeRe-dispatched from the native close event, after the dialog has closed.
cancelRe-dispatched from the native cancel event. Cancelable: calling preventDefault() stops the dialog from closing.
changeFires when a time is confirmed via "OK" and value actually changed.

CSS parts

PartDescription
dialogThe native <dialog> element.
containerThe visible card.
labelThe small label above the time display.
time-displayThe row holding the hour/minute fields and AM/PM toggle.
hour-fieldThe hour display/selector button.
minute-fieldThe minute display/selector button.
period-toggleThe AM/PM button pair. Only rendered for hourCycle="12".
dialThe clock face.
dial-numberEach selectable number on the dial.
actionsThe Cancel/OK row.

Source on GitHub npm