Date/time pickers — Fluxon-compatible API composed from LanternUI primitives.
<.date_picker field={@form[:due]} label="Due date" />
<.date_time_picker field={@form[:starts_at]} precision={:millisecond} />
<.time_picker name="alarm" value="08:45:00.000" />
<.date_range_picker start_field={@form[:from]} end_field={@form[:to]} />The public picker functions are date_picker/1 for a date,
date_time_picker/1 for a date and time, time_picker/1 for a time-only
field, and date_range_picker/1 for two date fields. canonical/2 is a
support helper used to normalize picker values before rendering; it is not a
component API.
The trigger is a segmented, directly-editable datetime_field (keyboard-first:
type straight into the segments); the calendar popover is for mouse users and
APG-grid keyboard navigation. time_picker is segments-only (no popover) —
a LanternUI extension Fluxon doesn't offer.
Value contract
The hidden input submits the canonical string (YYYY-MM-DD,
HH:MM:SS.mmm, YYYY-MM-DDTHH:MM:SS.mmm); empty = null. value accepts
that string or a Date / Time / NaiveDateTime / DateTime struct.
Fluxon compatibility
Attrs mirror Fluxon's pickers: field/name/value, label, sublabel,
description, help_text, errors, size, disabled, min/max,
week_start, and the inner/outer_prefix/suffix slots. display_format /
time_format are accepted for drop-in compatibility but not yet honored —
v1 renders the fixed segmented US format (m/d/yyyy, h:mm AM).
Summary
Functions
Date-only picker (YYYY-MM-DD).
Start/end date range, bound to two form fields.
Date + time picker (YYYY-MM-DDTHH:MM:SS.mmm).
Time-only picker (HH:MM:SS.mmm, segments only — no popover).
Functions
Date-only picker (YYYY-MM-DD).
Attributes
id(:any) - Element id; derived from field when omitted. Defaults tonil.label(:string) - Primary label above the control. Defaults tonil.sublabel(:string) - Secondary label line under the primary label. Defaults tonil.description(:string) - Helper text under the label stack. Defaults tonil.help_text(:string) - Trailing help line under the field when no errors. Defaults tonil.class(:any) - Extra classes merged onto the root element. Defaults tonil.size(:string) - Control density / type scale. Defaults to"md". Must be one of"xs","sm","md","lg", or"xl".disabled(:boolean) - Render disabled and non-interactive. Defaults tofalse.field(Phoenix.HTML.FormField) - Form field; derives id, name, value, and errors. Defaults tonil.value(:any) - Canonical date string or Date struct. Defaults tonil.name(:any) - Form input name; derived from field when omitted. Defaults tonil.errors(:list) - Validation messages; derived from field when used. Defaults to[].min(:string) - ISO min date; earlier calendar days are disabled. Defaults tonil.max(:string) - ISO max date; later calendar days are disabled. Defaults tonil.week_start(:integer) - First weekday column; 0 is Sunday, 1 is Monday. Defaults to0. Must be one of0,1,2,3,4,5, or6.display_format(:string) - accepted for Fluxon compat; not yet honored. Defaults tonil.form(:string) - HTML form attribute forwarded to the hidden value input (for editors outside the form element). Defaults tonil.- Global attributes are accepted. Arbitrary HTML/
phx-*attributes passed through.
Slots
inner_prefix- Affix inside the control, before the segments.outer_prefix- Affix outside the control, before the wrap.inner_suffix- Affix inside the control, after the segments.outer_suffix- Affix outside the control, after the wrap.
Start/end date range, bound to two form fields.
<.date_range_picker start_field={f[:from]} end_field={f[:to]} max={Date.utc_today()} />Each end submits its own canonical YYYY-MM-DD value, so the range lives in
two ordinary form fields rather than one parsed string.
Fluxon compatibility
Fluxon renders a range as ONE input driving a dual-month calendar; this
composes two date_pickers instead. Same field contract and same attrs
(start_field/end_field, min/max, label, size, disabled), so it
is a drop-in at the call site, but the panel is per-field rather than a linked
range calendar — picking a start does not constrain the end. navigation,
placeholder, and display_format are accepted and ignored.
Attributes
id(:any) - Element id prefix; derived from the start field when nil. Defaults tonil.label(:string) - Primary label above the pair. Defaults tonil.class(:any) - Extra classes merged onto the root element. Defaults tonil.size(:string) - Control density / type scale. Defaults to"md". Must be one of"xs","sm","md","lg", or"xl".disabled(:boolean) - Render disabled and non-interactive. Defaults tofalse.start_field(Phoenix.HTML.FormField) (required) - Form field for the range start.end_field(Phoenix.HTML.FormField) (required) - Form field for the range end.min(:any) - ISO string or Date; earlier days are disabled. Defaults tonil.max(:any) - ISO string or Date; later days are disabled. Defaults tonil.week_start(:integer) - First weekday column; 0 is Sunday, 1 is Monday. Defaults to0. Must be one of0,1,2,3,4,5, or6.separator(:string) - Text rendered between the two controls. Defaults to"to".navigation(:string) - accepted for Fluxon compat; not honored. Defaults tonil.placeholder(:string) - accepted for Fluxon compat; not honored. Defaults tonil.display_format(:string) - accepted for Fluxon compat; not honored. Defaults tonil.- Global attributes are accepted. Arbitrary HTML/
phx-*attributes passed through.
Date + time picker (YYYY-MM-DDTHH:MM:SS.mmm).
Attributes
id(:any) - Element id; derived from field when omitted. Defaults tonil.label(:string) - Primary label above the control. Defaults tonil.sublabel(:string) - Secondary label line under the primary label. Defaults tonil.description(:string) - Helper text under the label stack. Defaults tonil.help_text(:string) - Trailing help line under the field when no errors. Defaults tonil.class(:any) - Extra classes merged onto the root element. Defaults tonil.size(:string) - Control density / type scale. Defaults to"md". Must be one of"xs","sm","md","lg", or"xl".disabled(:boolean) - Render disabled and non-interactive. Defaults tofalse.field(Phoenix.HTML.FormField) - Form field; derives id, name, value, and errors. Defaults tonil.value(:any) - Canonical datetime string or DateTime/NaiveDateTime. Defaults tonil.name(:any) - Form input name; derived from field when omitted. Defaults tonil.errors(:list) - Validation messages; derived from field when used. Defaults to[].min(:string) - ISO min date; earlier calendar days are disabled. Defaults tonil.max(:string) - ISO max date; later calendar days are disabled. Defaults tonil.week_start(:integer) - First weekday column; 0 is Sunday, 1 is Monday. Defaults to0. Must be one of0,1,2,3,4,5, or6.precision(:atom) - Finest time segment shown in the field. Defaults to:minute. Must be one of:minute,:second, or:millisecond.display_format(:string) - accepted for Fluxon compat; not yet honored. Defaults tonil.time_format(:string) - accepted for Fluxon compat; not yet honored. Defaults tonil.form(:string) - HTML form attribute forwarded to the hidden value input (for editors outside the form element). Defaults tonil.- Global attributes are accepted. Arbitrary HTML/
phx-*attributes passed through.
Slots
inner_prefix- Affix inside the control, before the segments.outer_prefix- Affix outside the control, before the wrap.inner_suffix- Affix inside the control, after the segments.outer_suffix- Affix outside the control, after the wrap.
Time-only picker (HH:MM:SS.mmm, segments only — no popover).
Attributes
id(:any) - Element id; derived from field when omitted. Defaults tonil.label(:string) - Primary label above the control. Defaults tonil.sublabel(:string) - Secondary label line under the primary label. Defaults tonil.description(:string) - Helper text under the label stack. Defaults tonil.help_text(:string) - Trailing help line under the field when no errors. Defaults tonil.class(:any) - Extra classes merged onto the root element. Defaults tonil.size(:string) - Control density / type scale. Defaults to"md". Must be one of"xs","sm","md","lg", or"xl".disabled(:boolean) - Render disabled and non-interactive. Defaults tofalse.field(Phoenix.HTML.FormField) - Form field; derives id, name, value, and errors. Defaults tonil.value(:any) - Canonical time string or Time struct. Defaults tonil.name(:any) - Form input name; derived from field when omitted. Defaults tonil.errors(:list) - Validation messages; derived from field when used. Defaults to[].precision(:atom) - Finest time segment shown in the field. Defaults to:minute. Must be one of:minute,:second, or:millisecond.form(:string) - HTML form attribute forwarded to the hidden value input (for editors outside the form element). Defaults tonil.- Global attributes are accepted. Arbitrary HTML/
phx-*attributes passed through.
Slots
inner_prefix- Affix inside the control, before the segments.outer_prefix- Affix outside the control, before the wrap.inner_suffix- Affix inside the control, after the segments.outer_suffix- Affix outside the control, after the wrap.