PhoenixDuskmoon.Component.Form.Select (PhoenixDuskmoon v7.2.1)
View SourceSelect dropdown component for single selection.
Examples
<.dm_form for={@form} phx-submit="save">
<.dm_select field={@form[:country]} label="Country" options={country_options()} />
<.dm_select field={@form[:priority]} label="Priority" options={priority_options()} color="warning" />
</.dm_form>
<!-- With option groups -->
<.dm_select field={@form[:category]} label="Category">
<option value="">Select a category</option>
<optgroup label="Fruits">
<option value="apple">Apple</option>
<option value="orange">Orange</option>
</optgroup>
<optgroup label="Vegetables">
<option value="carrot">Carrot</option>
<option value="broccoli">Broccoli</option>
</optgroup>
</.dm_select>Attributes
field- Phoenix form fieldlabel- Select label textoptions- List of {value, label} tuples or keyword listprompt- Placeholder text for empty selectionsize- Select size: xs, sm, md, lg (default: md)color- Select color: primary, secondary, accent, info, success, warning, error (default: primary)disabled- Disable the selectmultiple- Enable multiple selectionclass- Additional CSS classeslabel_class- Additional CSS classes for labelselect_class- Additional CSS classes for select element
Summary
Functions
Attributes
id(:any) - Defaults tonil.name(:any)value(:any)field(Phoenix.HTML.FormField) - a form field struct retrieved from the form.label(:string) - Defaults tonil.options(:list) - Defaults tonil.prompt(:string) - Defaults tonil.size(:string) - Defaults to"md". Must be one of"xs","sm","md", or"lg".color(:string) - Defaults to"primary". Must be one of"primary","secondary","accent","info","success","warning", or"error".disabled(:boolean) - Defaults tofalse.multiple(:boolean) - Defaults tofalse.class(:string) - Defaults tonil.label_class(:string) - Defaults tonil.select_class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block