Select — mirrors Fluxon's select/1 surface: a FormField-aware select with
a rich listbox path and a native fallback.
<.select field={@form[:channel]} label="Channel" options={["eBay", "Shopify"]} />
<.select name="page_size" value="25" options={[10, 25, 50]} native />
<.select field={@form[:status]} options={[{"Active", "active"}, {"Archived", "archived"}]} placeholder="Any status" />Options are strings, atoms, numbers, or {label, value} tuples. The rich
path renders a button + listbox popover (LanternSelect hook: positioning,
focus, ↑/↓/Home/End/Enter/Esc, type-ahead) over a hidden input carrying the
value — form semantics identical to the native path.
searchable adds a search box to the listbox (client-side filtering; or set
search_threshold to auto-enable at N options). multiple turns the picker
into a multi-select: options toggle, the panel stays open, the toggle shows
a count, and one hidden name[] input is submitted per selected value.
Fluxon's on_search (server-driven options) is not yet implemented.
Summary
Functions
Attributes
id(:any) - Element id. Derived fromfieldwhen omitted. With a barenameand nofield, the rich path falls back toname(the id feeds a hook, so it must stay stable) whilenativeauto-generates a uniquelui-select-<n>, mirroring Fluxon. Pass an explicit id to get a stable, predictable id on the native path.Defaults to
nil.name(:any) - Form input name; derived from field when omitted. Defaults tonil.value(:any) - Selected value(s); list when multiple. Defaults tonil.field(Phoenix.HTML.FormField) - Form field; derives id, name, value, and errors. Defaults tonil.options(:list) - Choices as values or {label, value} tuples. Defaults to[].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.placeholder(:string) - Toggle text when nothing is selected. Defaults to"Select…".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.errors(:list) - Validation messages; derived from field when used. Defaults to[].native(:boolean) - Use a native <select> instead of the rich listbox. Defaults tofalse.include_hidden(:boolean) - Emit a blank hidden input so empty submits. Defaults totrue.prompt(:string) - blank first option (native path). Defaults tonil.searchable(:boolean) - search box inside the listbox. Defaults tofalse.search_threshold(:integer) - auto-enable search at N+ options. Defaults tonil.search_input_placeholder(:string) - Placeholder for the listbox search input. Defaults to"Search…".search_no_results_text(:string) - Empty-state copy when search matches nothing. Defaults to"No results".multiple(:boolean) - multi-select; submits name[] hidden inputs. Defaults tofalse.max(:integer) - max selections when multiple. Defaults tonil.clearable(:boolean) - show a clear (×) button that resets the selection (Fluxon parity). Defaults tofalse.class(:any) - Extra classes merged onto the root element. Defaults tonil.Global attributes are accepted. Arbitrary HTML/
phx-*attributes passed through. Supports all globals plus:["form", "phx-change", "phx-target"].