Elemental.Select (elemental v0.2.0)
An abstraction on top of DaisyUI's (& plain HTML) select.
This abstracts native HTML selects providing an API that is compatible
1-1 with Elemental.Dropdown
aiming to provide consistency between
the main/core input components provided by Elemental.
Usage
Most basic usage is done by simply passing it options
<.select options={["Foo", "Bar"]}/>
See select/1
for details on the support properties and their behaviour.
Summary
Functions
The primary select component.
Functions
The primary select component.
Attributes
options
(:list
) (required) - The list of values to select between. This is required to either be a list of strings, or a list of string tuples.List item types
- If given as a list of strings (
[String.t]
) each option will use that value as both it's label and value sent to from the dropdown. - If give as a list of tuples (
[{String.t, String.t}]
), those tuples are expected to be two strings, the first being the label to use, while the second is expected to be the value to send from the dropdown. - Mixing the two forms is allowed.
- Nested lists translate to option groups. See
Phoenix.HTML.Form.options_for_select/2
.
- If given as a list of strings (
prompt
(:string
) - The prompt to display for the the select. Defaults tonil
.name
(:string
) - The name of the dropdown, if not given a random value is selected.value
(:string
) - A value that is selected currently by the component.Useful for either preselecting items or to maintaining selected items state across rerenders.
Defaults to
nil
.color
(:string
) - The select prompt color.Must be one of"ghost"
,"neutral"
,"primary"
,"secondary"
,"accent"
,"info"
,"success"
,"warning"
, or"error"
.size
(:string
) - The select prompt size.Must be one of"xs"
,"sm"
,"md"
,"lg"
, or"xl"
.class
(:string
) - Additional CSS classes to pass to the select. Defaults tonil
.