timepicker-ui
4.6.0GitHub
timepicker-ui
Features / Toggle Button

Toggle Button

Open the picker from a calendar icon next to the field. This page documents @pglejzer/datepicker-ui, the companion of timepicker-ui.

Calendar icon button

#

ui.toggleButton takes a selector or an element. A click on it opens the picker, in addition to the input. The picker sets aria-expanded on the button, and its accessible name comes from your markup, so give it an aria-label.

index.html
<input id="date" />
<button id="open-date" type="button" aria-label="Choose date">...</button>
Toggle button
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
ui: { toggleButton: "#open-date" },
}).create();
Esc