timepicker-ui
4.6.0GitHub
timepicker-ui
Basic Examples / Modal Dialog

Modal Dialog

Show the calendar in a modal dialog with @pglejzer/datepicker-ui.

#

ui.displayMode: "modal" opens a dialog with a headline, the calendar and the Cancel and OK buttons. Nothing is written to the input until the user confirms. The modal always shows one month.

Modal
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
ui: { displayMode: "modal" },
}).create();

Start on the text input view

#

ui.initialView: "input" opens the modal on the text field instead of the grid. A button switches between the two views, and ui.viewSwitch controls it.

Input view
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
ui: { displayMode: "modal", initialView: "input" },
}).create();

Docs: Display Modes · Typed Input

Esc