PUI.DatePicker
(pui v1.0.0-beta.3)
Copy Markdown
Date picker components built from a trigger button and a popover calendar.
The calendar grid is rendered server-side by a LiveComponent, while the existing popover hook handles positioning and open/close behavior.
Examples
<.date_picker
id="published-on"
name="published_on"
label="Publish date"
min={~D[2026-04-10]}
max={~D[2026-04-30]}
/>
<.range_picker
id="trip-range"
from_name="trip_start"
to_name="trip_end"
label="Trip range"
>
<:footer>
<input
type="time"
class="border-input h-9 rounded-md border bg-transparent px-3 text-sm"
/>
</:footer>
</.range_picker>Common attributes
Both pickers support:
| Name | Type | Default | Description |
|---|---|---|---|
id | string | generated | Unique identifier used for the trigger and popup |
default_month | `Date.t() | String.t()` | nil | Initial month shown when no date is selected |
min | `Date.t() | String.t()` | nil | Minimum selectable day |
max | `Date.t() | String.t()` | nil | Maximum selectable day |
selectable_month | boolean | true | Shows native month and year selects in the calendar header |
placeholder | string | picker-specific | Placeholder text shown before a value is selected |
label | string | nil | Optional field label |
class | string | "w-full" | Additional trigger classes |
content_class | string | "" | Additional popup classes |
errors | list | [] | Error messages rendered below the picker |
show_errors | boolean | true | Controls error rendering |
Slots
| Name | Required | Description |
|---|---|---|
footer | — | Optional footer content rendered below the calendar grid |
Summary
Functions
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:any) - Defaults tonil.default_month(:any) - Defaults tonil.min(:any) - Defaults tonil.max(:any) - Defaults tonil.selectable_month(:boolean) - Defaults totrue.placeholder(:string) - Defaults to"Pick a date".class(:string) - Defaults to"w-full".content_class(:string) - Defaults to"".label(:string) - Defaults tonil.field(Phoenix.HTML.FormField) - a form field struct retrieved from the form, for example: @form[:published_on]. Defaults tonil.errors(:list) - Defaults to[].show_errors(:boolean) - Defaults totrue.
Slots
footer
Attributes
id(:string) - Defaults tonil.from_name(:string) - Defaults tonil.to_name(:string) - Defaults tonil.from_value(:any) - Defaults tonil.to_value(:any) - Defaults tonil.default_month(:any) - Defaults tonil.min(:any) - Defaults tonil.max(:any) - Defaults tonil.selectable_month(:boolean) - Defaults totrue.number_of_months(:integer) - Defaults to2.placeholder(:string) - Defaults to"Pick a date range".class(:string) - Defaults to"w-full".content_class(:string) - Defaults to"".label(:string) - Defaults tonil.from_field(Phoenix.HTML.FormField) - Defaults tonil.to_field(Phoenix.HTML.FormField) - Defaults tonil.errors(:list) - Defaults to[].show_errors(:boolean) - Defaults totrue.
Slots
footer