date-picker component

Drop-in semantic component. See examples, sizes, variants, and source.

Date selection with a popover calendar. Compose a date-picker wrapping a date-input, a calendar-trigger button, and a calendar-dropdown. Add range for a two-month range picker, primary/positive/etc. for accent color, or the size modifiers (xs sm xl lg). Behaviour (month navigation, date selection, range mode, preset chips) is wired by date-picker.js.

Date Picker

Single Date Selection

Sizes

Colors

Date Range Picker

Date Range Selection

Preset Date Ranges

States & Validation

Input States

Please select a valid date

Common Patterns

Form Integration

With Help Text

Must be 18 years or older

Inline Calendar

Always Visible Calendar

December 2024
Su
Mo
Tu
We
Th
Fr
Sa

Class API Reference

Type Class Usage Notes
Base date-picker Required wrapper for trigger + dropdown Always required
date-input The input element that displays the value Use readonly to disable typing
calendar-trigger The calendar icon button that opens the dropdown Sits inside date-picker
calendar-dropdown The popover calendar panel Toggle hidden to show / hide
Calendar Parts calendar-header Top bar with month / year nav Contains prev-month, month-year, next-month
month-select / year-select Dropdowns for jumping months / years Or use month-year-label for static text
calendar-weekdays Header row of day names 7 child <div>s
calendar-dates Grid of date cells Populated by JS as date-cell children
calendar-footer Bottom action row Hosts today-btn, clear-btn, cancel-btn, apply-btn
inline-calendar Always-visible calendar (no input/dropdown) Standalone — replaces date-picker
Date Cell date-cell Single day cell (set by JS) Inside calendar-dates
today Today's date — accent color, bold Modifier on date-cell
selected Selected date — filled background Modifier on date-cell
in-range Day inside a selected range Tinted background
range-start / range-end Boundary days of a range Rounded on the outer corner
other-month / disabled Greyed-out days Outside current month / not selectable
Sizes xs Tiny — 24px input, 12px text Modifier on date-picker
sm Small Modifier on date-picker
(default) Medium No size class needed
xl Large Modifier on date-picker
lg Big Modifier on date-picker
Variant range Two-month range picker Pair with preset-ranges chips
preset-ranges Container of quick-pick range buttons Children use data-range="today|last7|..."
Color primary Blue accent Modifier on date-picker
positive Green accent Modifier on date-picker
negative Red accent Modifier on date-picker
warning Yellow accent Modifier on date-picker
info Light-blue accent Modifier on date-picker
States disabled Disables input + trigger Modifier on date-picker
error Red border + reveals error-message Modifier on date-picker
hidden Hides the dropdown Toggled by JS on calendar-dropdown