Date, date-range and time pickers, plus an inline calendar.
Summary
Functions
Renders an inline calendar: a month grid that is always visible, for scheduling views, sidebars and availability pickers.
Renders a date field: a native <input type="date"> (typed entry, mobile
pickers, min/max validation, phx-change) plus a calendar popover for
pointer and keyboard selection.
Renders a date range: two native date inputs sharing one calendar, where the first click picks the start and the second the end.
Renders a time field: a native <input type="time"> (typed entry, mobile
pickers, min/max, phx-change) plus a popover list of time slots.
Functions
Renders an inline calendar: a month grid that is always visible, for scheduling views, sidebars and availability pickers.
<.calendar id="when" name="when" value={@date} on_change={JS.push("pick-day")} />
<.calendar id="stay" range from_name="from" to_name="to" from_value={@from} to_value={@to} min={Date.utc_today()} />Hidden inputs carry the value(s) so the calendar works inside a form
(phx-change fires on every pick). on_change runs with phx-value-date
(and phx-value-end for ranges) once a selection is complete. Re-render
with a new value to control the selection from the server.
Keyboard: arrows move by day and week, PageUp/PageDown by month, Shift+PageUp/PageDown by year, Home/End to the week bounds, Enter or Space selects. The grid follows the WAI-ARIA grid pattern with a roving tab stop.
Attributes
id(:string) (required)name(:any) - hidden input name for the (start) value. Defaults tonil.value(:any) - Defaults tonil.range(:boolean) - Defaults tofalse.from_name(:any) - range: name for the start; defaults toname. Defaults tonil.to_name(:any) - range: name for the end. Defaults tonil.from_value(:any) - range: start; defaults tovalue. Defaults tonil.to_value(:any) - Defaults tonil.min(:any) - Defaults tonil.max(:any) - Defaults tonil.locale(:string) - BCP 47 tag; defaults to the browser's. Defaults tonil.footer(:boolean) - show the Clear / Today buttons. Defaults totrue.label(:string) - accessible name; defaults to "Calendar". Defaults tonil.on_change(Phoenix.LiveView.JS) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Renders a date field: a native <input type="date"> (typed entry, mobile
pickers, min/max validation, phx-change) plus a calendar popover for
pointer and keyboard selection.
<.date_picker field={@form[:due_on]} label="Due on" min={Date.utc_today()} />
<.date_picker name="from" value={~D[2026-09-11]} label="From" locale="de-DE" />Values are ISO 8601 dates (Date structs or "YYYY-MM-DD" strings). The
calendar is rendered by the hook in the browser's (or locale's) language,
with the locale's first day of the week. Keyboard in the calendar: arrows
move by day and week, PageUp/PageDown by month, Home/End to week bounds,
Enter selects, Escape closes.
Attributes
id(:any) - Defaults tonil.name(:any)value(:any)label(:string) - Defaults tonil.description(:string) - Defaults tonil.min(:any) - Defaults tonil.max(:any) - Defaults tonil.locale(:string) - BCP 47 tag; defaults to the browser's. Defaults tonil.field(Phoenix.HTML.FormField)errors(:list) - Defaults to[].size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".disabled(:boolean) - Defaults tofalse.required(:boolean) - Defaults tofalse.style(:string) - inline style for the field wrapper. Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["autocomplete", "form", "readonly"].
Renders a date range: two native date inputs sharing one calendar, where the first click picks the start and the second the end.
<.date_range_picker from={@form[:starts_on]} to={@form[:ends_on]} label="Dates" />
<.date_range_picker id="trip" from_name="from" to_name="to" from_value={~D[2026-10-01]} to_value={~D[2026-10-07]} label="Trip" />Attributes
id(:any) - Defaults tonil.from(Phoenix.HTML.FormField)to(Phoenix.HTML.FormField)from_name(:any)to_name(:any)from_value(:any)to_value(:any)label(:string) - Defaults tonil.description(:string) - Defaults tonil.min(:any) - Defaults tonil.max(:any) - Defaults tonil.locale(:string) - Defaults tonil.errors(:list) - Defaults to[].size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".disabled(:boolean) - Defaults tofalse.required(:boolean) - Defaults tofalse.style(:string) - inline style for the field wrapper. Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Renders a time field: a native <input type="time"> (typed entry, mobile
pickers, min/max, phx-change) plus a popover list of time slots.
<.time_picker field={@form[:starts_at]} label="Starts at" step={15} min="09:00" max="17:30" />
<.time_picker name="at" value="09:30" label="At" hour_cycle="h23" />Values are "HH:MM" strings or Time structs. step is in minutes and
drives both the native input's granularity and the slot list. Slots are
formatted in the browser's (or locale's) convention; set hour_cycle to
"h12" or "h23" to force one.
Keyboard: the clock button (or Alt+ArrowDown in the input) opens the list;
arrows move, PageUp/PageDown jump an hour, Home/End to the bounds, typing
jumps to a matching slot (9:3 or 14), Enter selects, Escape closes.
Attributes
id(:any) - Defaults tonil.name(:any)value(:any)label(:string) - Defaults tonil.description(:string) - Defaults tonil.step(:integer) - minutes between slots. Defaults to30.min(:any) - Defaults tonil.max(:any) - Defaults tonil.locale(:string) - Defaults tonil.hour_cycle(:string) - Defaults tonil.Must be one ofnil,"h12", or"h23".field(Phoenix.HTML.FormField)errors(:list) - Defaults to[].size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".disabled(:boolean) - Defaults tofalse.required(:boolean) - Defaults tofalse.style(:string) - inline style for the field wrapper. Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["autocomplete", "form", "readonly"].