Date picker: one date, several dates or a range, with limits, disabled days, a custom text format and presets. The calendar pops under the input or stays inline.
<.date_picker field={@form[:due_on]} placeholder="Choose date..." />
<.date_picker name="trip" mode="range" value={{~D[2026-10-10], ~D[2026-10-20]}} />
<.date_picker name="days" mode="multiple" disabled_weekdays={[0, 6]} week_start={1} />
<.date_picker start_field={@form[:from]} end_field={@form[:to]} locale="pt_BR"
presets={[{"Este mês", "this_month"}, {"Mês passado", "last_month"}]} />The input shows the date in display_format (flatpickr tokens Y y m n d j F M l D); the
form gets ISO text through hidden inputs named like the field (name for one date,
name[] for multiple and range, with an empty name[] first). A pick fires a
bubbling input event, so phx-change runs.
The behaviour lives in the LedgerUI.DatePicker hook (priv/static/ledger_ui/hooks/date_picker.js).
The popup is an overlay: LedgerUI.open/close/toggle("id-pop") is not needed, the hook
opens it; date_picker_clear/1 empties the picker.
date_picker_panel/1 renders just the calendar surface (lu-pop > lu-cal), the markup the
popup is made of.
Summary
Functions
Renders a date input with its calendar.
The lu-cal month: title, arrows, weekday letters and day buttons.
A Phoenix.LiveView.JS command that empties the date picker id (the one given to id).
The calendar surface of the picker: month title with arrows, weekday letters and the days,
optionally with a column of presets on the left.
Functions
Renders a date input with its calendar.
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:any)field(Phoenix.HTML.FormField) - Defaults tonil.label(:string) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].placeholder(:string) - Defaults tonil.mode(:string) - Defaults to"single". Must be one of"single","multiple", or"range".range(:boolean) - The same asmode="range". Defaults tofalse.start_field(Phoenix.HTML.FormField) - Defaults tonil.end_field(Phoenix.HTML.FormField) - Defaults tonil.start_name(:string) - Defaults tonil.end_name(:string) - Defaults tonil.presets(:list) - Defaults to[].locale(:string) - Defaults to"en". Must be one of"en", or"pt_BR".range_separator(:string) - Defaults tonil.labels(:map) - Defaults to%{}.min(:any) - Defaults tonil.max(:any) - Defaults tonil.disabled_dates(:list) - Defaults to[].disabled_weekdays(:list) - Defaults to[].week_start(:integer) - Defaults to0.display_format(:string) - Defaults tonil.months(:list) - Defaults tonil.weekdays(:list) - Defaults tonil.today(:any) - Defaults tonil.inline(:boolean) - Defaults tofalse.show_icon(:boolean) - Defaults totrue.skin(:string) - Defaults tonil.Must be one ofnil,"", or"linea".size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".disabled(:boolean) - Defaults tofalse.on_change(:string) - Defaults tonil.target(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
icon- Replaces the calendar icon.trailing- Buttons joined to the right of the input.
The lu-cal month: title, arrows, weekday letters and day buttons.
Attributes
month(:any) - Defaults tonil.selected(:any) - Defaults tonil.range(:any) - Defaults tonil.today(:any) - Defaults tonil.min(:any) - Defaults tonil.max(:any) - Defaults tonil.disabled_dates(:list) - Defaults to[].disabled_weekdays(:list) - Defaults to[].week_start(:integer) - Defaults to0.locale(:string) - Defaults to"en".months(:list) - Defaults tonil.weekdays(:list) - Defaults tonil.labels(:map) - Defaults to%{}.- Global attributes are accepted.
A Phoenix.LiveView.JS command that empties the date picker id (the one given to id).
<button phx-click={date_picker_clear("due")}>×</button>
The calendar surface of the picker: month title with arrows, weekday letters and the days,
optionally with a column of presets on the left.
Attributes
month(:any) - ADateof the month to show (today's month by default). Defaults tonil.selected(:any) - A date or a list of dates drawn as selected. Defaults tonil.range(:any) -{from, to}: painted as a continuous band. Defaults tonil.today(:any) - Defaults tonil.min(:any) - Defaults tonil.max(:any) - Defaults tonil.disabled_dates(:list) - Defaults to[].disabled_weekdays(:list) - Defaults to[].week_start(:integer) - Defaults to0.locale(:string) - Defaults to"en".months(:list) - Defaults tonil.weekdays(:list) - Defaults tonil.labels(:map) - Defaults to%{}.presets(:list) - Defaults to[].class(:any) - Defaults tonil.- Global attributes are accepted.