Calendar
A monthly calendar grid for date selection, range selection, and LiveView-owned month navigation.
June 2026
Date Picker Composition
Calendar is the grid primitive. Pair it with
popover
and a hidden form input when you need a date-picker field.
Interactive
Pass a
select_event
for date clicks and a
nav_event
for month navigation. The events carry different payloads —
phx-value-date
for selection,
phx-value-year
and
phx-value-month
for navigation.
July 2026
Selected: No date selected
Monday Start
Set
week_start
to choose the first weekday. Use
0
for Sunday,
1
for Monday, up to
6
for Saturday.
June 2026
Range Selection
Use
mode="range"
with
selected
(range start) and
range_end
to highlight a span of dates. Dates between the endpoints get the
calendar-day-in-range
style.
June 2026
Start
No date selected
End
No date selected
Disabled Dates
Pass a list of
Date
structs or ISO strings to
disabled_dates
. Disabled dates can't be clicked and render with reduced opacity.
June 2026
Notes
- The parent LiveView owns date state. Click a selected date again to clear it, or keep the date selected in your event handler.
-
Use
select_eventfor date clicks andnav_eventfor month navigation. For year jumps, render your own controls around the calendar and assignyear/monthfrom the parent LiveView. -
Each day is a native
<button>— keyboard-focusable and operable. The grid usesrole="grid"withrole="gridcell". -
Days outside the displayed month are visually muted and marked with
data-outside— they still render so the grid stays rectangular.