A plain select: the browser's own <select> in the frame of the input group, for a short list that needs no
search (a status, a role, a currency). For a long list, or one that is searched, use DevactionUI.Combobox.
Options are {label, value} tuples, a keyword list, plain strings, %{value: ..., label: ...} maps (with an
optional disabled: true), or groups {"Group", [options]} that become <optgroup>s. prompt is a first
empty option (Choose a status), drawn in the muted text of a placeholder while it is the choice.
multiple is the native list box: the name ends in [] and the value is a list. With
field={@form[:status]} the id, the name, the value and the error state come from the form (see
DevactionUI.FormField); what is given by hand wins. The error message is not drawn here: wrap the select in
DevactionUI.Field, as any other input.
On a mouse or a trackpad the open list is a styled panel under the select (the groups as headers, the chosen
option with a check, a disabled option muted) drawn by the DevactionUI.Select hook from the options; the
<select> stays the field, so the name, the value, the validation and phx-change are the browser's own, and
on a touch screen the system picker opens. multiple stays the native list box.
The arrow and the leading icon are slots (the library knows no icon set); without chevron_icon the arrow is
a ⌄. Sizes follow the input group: :sm 36px, :md 44px, :lg 52px.
Summary
Functions
A native select in the frame of the input group.
Functions
A native select in the frame of the input group.
Attributes
id(:string) - required unless afieldgives it. Defaults tonil.name(:string) - Defaults tonil.field(Phoenix.HTML.FormField) - a form field (@form[:status]): gives theid, thename, the value and the error state. Defaults tonil.options(:list) (required) -{label, value}, strings,%{value, label, disabled}maps or{group, options}groups.value(:any) - the chosen value, or a list of them withmultiple. Defaults tonil.prompt(:string) - a first empty option, such asChoose a status. Defaults tonil.multiple(:boolean) - the native list box; the name ends in[]. Defaults tofalse.size(:atom) - 36, 44 or 52 px high. Defaults to:md. Must be one of:sm,:md, or:lg.invalid(:boolean) - Defaults tofalse.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["disabled", "required", "form", "autofocus", "autocomplete"].
Slots
icon- drawn before the text, muted.chevron_icon- the arrow at the end; a⌄when there is none.