Time picker: an input with a clock icon that opens a scrollable list of times
(variant="input"), or a list of fixed slots (variant="list").
<.time_picker field={@form[:opens_at]} placeholder="Choose time..." />
<.time_picker name="alarm" time_24hr min_time="15:00" max_time="22:30" minute_step={15} />
<.time_picker field={@form[:slot]} variant="list" min_time="14:00" max_time="14:45" minute_step={15} />The form gets "HH:MM" (24-hour) through a hidden input named like the field and every change
fires a bubbling input event, so phx-change runs. The behaviour lives in the
LedgerUI.TimePicker hook (priv/static/ledger_ui/hooks/time_picker.js).
time_picker_panel/1 renders only the popup surface (lu-pop > lu-times).
Summary
Functions
Renders a time input.
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.time_24hr(:boolean) - Defaults tofalse.min_time(:string) - Defaults tonil.max_time(:string) - Defaults tonil.minute_step(:integer) - Defaults to5.step(:integer) - The same asminute_step; it wins when given. Defaults tonil.hour_step(:integer) - Defaults to1.default_hour(:integer) - Defaults to12.display_format(:string) - Defaults tonil.locale(:string) - Defaults to"en". Must be one of"en", or"pt_BR".labels(:map) - Defaults to%{}.variant(:string) - Defaults to"input". Must be one of"input", or"list".show_icon(:boolean) - Defaults totrue.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 clock icon.trailing- Buttons joined to the right of the input.
The popup surface: a lu-pop with the list of times.
Attributes
times(:list) - The"HH:MM"texts of the buttons. Defaults to[].value(:any) - The chosen time ("HH:MM") highlighted. Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.