LanternUI.Components.DatePicker (LanternUI v0.3.1)

Copy Markdown View Source

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" />

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).

Date + time picker (YYYY-MM-DDTHH:MM:SS.mmm).

Time-only picker (HH:MM:SS.mmm, segments only — no popover).

Functions

date_picker(assigns)

Date-only picker (YYYY-MM-DD).

Attributes

  • id (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • sublabel (:string) - Defaults to nil.
  • description (:string) - Defaults to nil.
  • help_text (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • size (:string) - Defaults to "md". Must be one of "xs", "sm", "md", "lg", or "xl".
  • disabled (:boolean) - Defaults to false.
  • field (Phoenix.HTML.FormField) - Defaults to nil.
  • value (:any) - Defaults to nil.
  • name (:any) - Defaults to nil.
  • errors (:list) - Defaults to [].
  • min (:string) - Defaults to nil.
  • max (:string) - Defaults to nil.
  • week_start (:integer) - Defaults to 0. Must be one of 0, 1, 2, 3, 4, 5, or 6.
  • display_format (:string) - accepted for Fluxon compat; not yet honored. Defaults to nil.
  • form (:string) - HTML form attribute forwarded to the hidden value input (for editors outside the form element). Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_prefix
  • outer_prefix
  • inner_suffix
  • outer_suffix

date_time_picker(assigns)

Date + time picker (YYYY-MM-DDTHH:MM:SS.mmm).

Attributes

  • id (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • sublabel (:string) - Defaults to nil.
  • description (:string) - Defaults to nil.
  • help_text (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • size (:string) - Defaults to "md". Must be one of "xs", "sm", "md", "lg", or "xl".
  • disabled (:boolean) - Defaults to false.
  • field (Phoenix.HTML.FormField) - Defaults to nil.
  • value (:any) - Defaults to nil.
  • name (:any) - Defaults to nil.
  • errors (:list) - Defaults to [].
  • min (:string) - Defaults to nil.
  • max (:string) - Defaults to nil.
  • week_start (:integer) - Defaults to 0. Must be one of 0, 1, 2, 3, 4, 5, or 6.
  • precision (:atom) - Defaults to :minute. Must be one of :minute, :second, or :millisecond.
  • display_format (:string) - accepted for Fluxon compat; not yet honored. Defaults to nil.
  • time_format (:string) - accepted for Fluxon compat; not yet honored. Defaults to nil.
  • form (:string) - HTML form attribute forwarded to the hidden value input (for editors outside the form element). Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_prefix
  • outer_prefix
  • inner_suffix
  • outer_suffix

time_picker(assigns)

Time-only picker (HH:MM:SS.mmm, segments only — no popover).

Attributes

  • id (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • sublabel (:string) - Defaults to nil.
  • description (:string) - Defaults to nil.
  • help_text (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • size (:string) - Defaults to "md". Must be one of "xs", "sm", "md", "lg", or "xl".
  • disabled (:boolean) - Defaults to false.
  • field (Phoenix.HTML.FormField) - Defaults to nil.
  • value (:any) - Defaults to nil.
  • name (:any) - Defaults to nil.
  • errors (:list) - Defaults to [].
  • precision (:atom) - 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 to nil.
  • Global attributes are accepted.

Slots

  • inner_prefix
  • outer_prefix
  • inner_suffix
  • outer_suffix