Date Picker

A date selection component with calendar popup and optional text input, powered by vanilla-calendar-pro.

API Reference

DatePicker

NameTypeDefault
name:stringnil
Form field name for the date picker. Used to identify the selected date value when forms are submitted.
id:stringnil
HTML ID for the input element. When select_only is true, the ID is applied to the button trigger instead of a text input.
value:DateTime/Stringnil
Initial date value. Accepts DateTime objects or ISO date strings. Automatically converts to UTC for consistent handling.
format:string"DD/MM/YYYY"
Display format for the selected date. Uses dayjs format tokens for customization.
select_only:booleanfalse
When true, disables text input and only allows date selection via calendar popup. Useful for preventing manual date entry.
placeholder:stringnil
Placeholder text displayed in the input field when no date is selected. Provides guidance to users about expected date format.
disabled:booleanfalse
Whether the date picker is disabled and non-interactive. When true, prevents user interaction and form submission.
options:hash{}
Configuration options passed to vanilla-calendar-pro. Allows customization of calendar behavior, appearance, and date constraints.
mask:booleantrue
Whether to apply input masking to the text field for guided date entry. Helps users enter dates in the correct format automatically.
attributeskeyword arguments

Keyboard Interactions

KeyDescription
SpaceOpens/closes the popover when focus is on calendar button.
EnterOpens/closes the popover when focus is on calendar button.
TabMoves focus to the next focusable element.
Shift+TabMoves focus to the previous focusable element.
EscCloses the popver.

Examples