Date Range Picker

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

API Reference

DateRangePicker

NameTypeDefault
name:arraynil
Array of two strings for form field names: [start_date_name, end_date_name]. Used to identify the selected date range values 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 text inputs.
value:arraynil
Array of two date values: [start_date, end_date]. Accepts DateTime objects or ISO date strings. Automatically converts to UTC for consistent handling.
format:string"DD/MM/YYYY"
Display format for the selected dates. 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 range is selected. Provides guidance about expected date range format.
disabled:booleanfalse
Whether the date range 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, range selection, and date constraints.
mask:booleantrue
Whether to apply input masking to the text field for guided date entry. Helps users enter date ranges 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