# `LedgerUI.Components.DatetimePicker`
[🔗](https://github.com/devaction-labs/ledger_ui/blob/v0.2.0/lib/ledger_ui/components/datetime_picker.ex#L1)

A date and a time chosen in one panel: a calendar with a list of times beside it or, for a
range, two months side by side with a start and an end time.

    <.datetime_picker field={@form[:starts_at]} label="Starts at" />
    <.datetime_picker name="meeting" interval={15} min="now" min_time="08:00" max_time="18:00" />
    <.datetime_picker name="slot" time="input" unavailable="12:00-13:00, 2026-10-14, 2026-10-15T10:00" />
    <.datetime_picker name="shift" mode="range" default_time="09:00/17:00" locale="pt_BR" />

The value is wall-clock text like a native `datetime-local` input (`2026-10-14T10:30`, no time
zone, no conversion), sent through a hidden input named like the field (a range sends `name[]`
with an empty first one, or two fields with `start_field`/`end_field` or
`start_name`/`end_name`). A bubbling `input` event fires on every change.

The behaviour lives in the `LedgerUI.DatetimePicker` hook
(`priv/static/ledger_ui/hooks/datetime_picker.js`). `datetime_picker_panel/1` renders just the
static panel surface.

# `date_time_picker`

Same as `datetime_picker/1` (same attributes and slots), under the name the design vitrine uses.
## Attributes

* `id` (`:string`) - Defaults to `nil`.
* `name` (`:string`) - Defaults to `nil`.
* `value` (`:any`)
* `field` (`Phoenix.HTML.FormField`) - Defaults to `nil`.
* `label` (`:string`) - Defaults to `nil`.
* `help` (`:string`) - Defaults to `nil`.
* `timezone` (`:string`) - Defaults to `nil`.
* `errors` (`:list`) - Defaults to `[]`.
* `placeholder` (`:string`) - Defaults to `nil`.
* `mode` (`:string`) - Defaults to `"single"`. Must be one of `"single"`, or `"range"`.
* `start_field` (`Phoenix.HTML.FormField`) - Defaults to `nil`.
* `end_field` (`Phoenix.HTML.FormField`) - Defaults to `nil`.
* `start_name` (`:string`) - Defaults to `nil`.
* `end_name` (`:string`) - Defaults to `nil`.
* `interval` (`:integer`) - Defaults to `30`.
* `time` (`:string`) - Defaults to `"list"`. Must be one of `"list"`, or `"input"`.
* `default_time` (`:string`) - Defaults to `nil`.
* `time_format` (`:string`) - Defaults to `"auto"`. Must be one of `"auto"`, `"12"`, or `"24"`.
* `time_24hr` (`:boolean`) - Defaults to `nil`.
* `minute_step` (`:integer`) - Defaults to `nil`.
* `default_hour` (`:integer`) - Defaults to `nil`.
* `locale` (`:string`) - Defaults to `"en"`. Must be one of `"en"`, or `"pt_BR"`.
* `display_format` (`:string`) - Defaults to `nil`.
* `range_separator` (`:string`) - Defaults to `" – "`.
* `min` (`:any`) - Defaults to `nil`.
* `max` (`:any`) - Defaults to `nil`.
* `min_time` (`:string`) - Defaults to `nil`.
* `max_time` (`:string`) - Defaults to `nil`.
* `unavailable` (`:any`) - Defaults to `[]`.
* `week_start` (`:integer`) - Defaults to `0`.
* `months` (`:list`) - Defaults to `nil`.
* `weekdays` (`:list`) - Defaults to `nil`.
* `today` (`:any`) - Defaults to `nil`.
* `labels` (`:map`) - Defaults to `%{}`.
* `layout` (`:string`) - Defaults to `"auto"`. Must be one of `"auto"`, or `"compact"`.
* `variant` (`:string`) - Defaults to `"outlined"`. Must be one of `"outlined"`, or `"filled"`.
* `split` (`:boolean`) - Defaults to `false`.
* `date_label` (`:string`) - Defaults to `nil`.
* `time_label` (`:string`) - Defaults to `nil`.
* `size` (`:string`) - Defaults to `"md"`. Must be one of `"sm"`, `"md"`, or `"lg"`.
* `placement` (`:string`) - Defaults to `"bottom-start"`. Must be one of `"top"`, `"bottom"`, `"left"`, `"right"`, `"top-start"`, `"top-end"`, `"bottom-start"`, `"bottom-end"`, `"left-start"`, `"left-end"`, `"right-start"`, or `"right-end"`.
* `show_icon` (`:boolean`) - Defaults to `true`.
* `disabled` (`:boolean`) - Defaults to `false`.
* `on_change` (`:string`) - Defaults to `nil`.
* `target` (`:any`) - Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `icon` - Replaces the calendar icon.
* `trigger` - Replaces the input: any button inside opens the panel.

# `datetime_picker`

Renders the date and time input with its panel.
## Attributes

* `id` (`:string`) - Defaults to `nil`.
* `name` (`:string`) - Defaults to `nil`.
* `value` (`:any`)
* `field` (`Phoenix.HTML.FormField`) - Defaults to `nil`.
* `label` (`:string`) - Defaults to `nil`.
* `help` (`:string`) - Defaults to `nil`.
* `timezone` (`:string`) - Defaults to `nil`.
* `errors` (`:list`) - Defaults to `[]`.
* `placeholder` (`:string`) - Defaults to `nil`.
* `mode` (`:string`) - Defaults to `"single"`. Must be one of `"single"`, or `"range"`.
* `start_field` (`Phoenix.HTML.FormField`) - Defaults to `nil`.
* `end_field` (`Phoenix.HTML.FormField`) - Defaults to `nil`.
* `start_name` (`:string`) - Defaults to `nil`.
* `end_name` (`:string`) - Defaults to `nil`.
* `interval` (`:integer`) - Defaults to `30`.
* `time` (`:string`) - Defaults to `"list"`. Must be one of `"list"`, or `"input"`.
* `default_time` (`:string`) - Defaults to `nil`.
* `time_format` (`:string`) - Defaults to `"auto"`. Must be one of `"auto"`, `"12"`, or `"24"`.
* `time_24hr` (`:boolean`) - Defaults to `nil`.
* `minute_step` (`:integer`) - Defaults to `nil`.
* `default_hour` (`:integer`) - Defaults to `nil`.
* `locale` (`:string`) - Defaults to `"en"`. Must be one of `"en"`, or `"pt_BR"`.
* `display_format` (`:string`) - Defaults to `nil`.
* `range_separator` (`:string`) - Defaults to `" – "`.
* `min` (`:any`) - Defaults to `nil`.
* `max` (`:any`) - Defaults to `nil`.
* `min_time` (`:string`) - Defaults to `nil`.
* `max_time` (`:string`) - Defaults to `nil`.
* `unavailable` (`:any`) - Defaults to `[]`.
* `week_start` (`:integer`) - Defaults to `0`.
* `months` (`:list`) - Defaults to `nil`.
* `weekdays` (`:list`) - Defaults to `nil`.
* `today` (`:any`) - Defaults to `nil`.
* `labels` (`:map`) - Defaults to `%{}`.
* `layout` (`:string`) - Defaults to `"auto"`. Must be one of `"auto"`, or `"compact"`.
* `variant` (`:string`) - Defaults to `"outlined"`. Must be one of `"outlined"`, or `"filled"`.
* `split` (`:boolean`) - Defaults to `false`.
* `date_label` (`:string`) - Defaults to `nil`.
* `time_label` (`:string`) - Defaults to `nil`.
* `size` (`:string`) - Defaults to `"md"`. Must be one of `"sm"`, `"md"`, or `"lg"`.
* `placement` (`:string`) - Defaults to `"bottom-start"`. Must be one of `"top"`, `"bottom"`, `"left"`, `"right"`, `"top-start"`, `"top-end"`, `"bottom-start"`, `"bottom-end"`, `"left-start"`, `"left-end"`, `"right-start"`, or `"right-end"`.
* `show_icon` (`:boolean`) - Defaults to `true`.
* `disabled` (`:boolean`) - Defaults to `false`.
* `on_change` (`:string`) - Defaults to `nil`.
* `target` (`:any`) - Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `icon` - Replaces the calendar icon.
* `trigger` - Replaces the input: any button inside opens the panel.

# `datetime_picker_panel`

The static panel: a calendar with the list of times beside it.
## Attributes

* `month` (`:any`) - Defaults to `nil`.
* `selected` (`:any`) - Defaults to `nil`.
* `today` (`:any`) - Defaults to `nil`.
* `week_start` (`:integer`) - Defaults to `0`.
* `locale` (`:string`) - Defaults to `"en"`.
* `times` (`:list`) - The `"HH:MM"` texts of the time buttons. Defaults to `[]`.
* `time` (`:string`) - The chosen `"HH:MM"`. Defaults to `nil`.
* `timezone` (`:string`) - A time zone caption over the list of times. Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
