Native select
v0.0.10
mix mishka.ui.gen.component native_select
Native select
Native select
Native select
<.native_select
name="countries"
space="small"
color="danger"
description="This is description"
label="This is outline label"
>
</.native_select>Native select multiple props
Native select multiple props
<.native_select
multiple
name="countries"
space="small"
description="This is description"
label="This is outline label"
>
<:option value="nl">
NL
</:option>
<:option value="usa">
USA
</:option>
<:option value="uae">
UAE
</:option>
</.native_select>Native select option slot
The option slot within a select element is used to define individual options for the dropdown. Each option in the select is created within this slot and has three key attributes. The value attribute represents the value associated with the option, which will be submitted when the option is selected. The selected attribute can be used to indicate which option is currently selected by default, providing a pre-selected choice when the form is rendered. The disabled attribute, when set, will disable the option, preventing users from selecting it. These attributes make it easy to manage and customize each option within a select field, ensuring flexibility in form handling.
Native select option slot
<.native_select
name="countries"
space="small"
description="This is description"
label="This is outline label"
>
<:option value="nl" selected>
NL
</:option>
<:option value="usa" disabled>
USA
</:option>
<:option value="uae">
UAE
</:option>
</.native_select>Attributes
| Name | Type | Default | Values | Required | Description |
|---|---|---|---|---|---|
id
|
string
| — | — | No | A unique identifier is used to manage state and interaction |
class
|
any
| — | — | No | Custom CSS class for additional styling |
color
|
string
|
natural
|
basewhitenaturalprimarysecondarydarksuccesswarningdangerinfosilvermiscdawn
| No | Determines color theme |
border
|
string
|
extra_small
| — | No | Determines border style |
rounded
|
string
|
small
|
extra_smallsmallmediumlargeextra_largefullnone
| No | Determines the border radius |
variant
|
string
|
base
|
defaultshadowborderednativebase
| No | Determines the style |
description
|
string
| — | — | No | Determines a short description |
space
|
string
|
medium
|
extra_smallsmallmediumlargeextra_largenone
| No | Space between items |
min_height
|
string
| — | — | No | Determines min height style |
description_class
|
string
|
text-[12px]
| — | No | Custom classes for description |
label_class
|
string
| — | — | No | Custom CSS class for the label styling |
field_wrapper_class
|
string
| — | — | No | Custom CSS class field wrapper |
select_class
|
string
| — | — | No | Custom CSS class for additional styling |
description_wrapper_class
|
string
| — | — | No | Custom classes for description wrapper |
size
|
string
|
extra_large
|
extra_smallsmallmediumlargeextra_large
| No | Determines the overall size of the elements, including padding, font size, and other items |
ring
|
boolean
|
true
| — | No | Determines a ring border on focused input, utilities for creating outline rings with box-shadows. |
error_icon
|
string
| — | — | No | Icon to be displayed alongside error messages |
label
|
string
| — | — | No | Specifies text for the label |
multiple
|
boolean
|
false
| — | No | Specifies if the select input allows multiple selections |
errors
|
list
|
[]
| — | No | List of error messages to be displayed |
name
|
any
| — | — | No | Name of input |
field
|
Phoenix.HTML.FormField
| — | — | No | a form field struct retrieved from the form |
rest
|
global
| — | — | No | Global attributes can define defaults which are merged with attributes provided by the caller |
Slots
| Name | Required | Description |
|---|---|---|
inner_block
| No | Inner block that renders HEEx content |
option
| No | — |
Attributes of the option slot
| Name | Type | Default | Values | Required | Description |
|---|---|---|---|---|---|
value
|
string
| — | — | No | Value of each select option |
selected
|
boolean
| — | — | No | Specifies this option is selected |
disabled
|
boolean
| — | — | No | Specifies this option is disabled |
Options
Each option takes one or more of its values, separated by commas.
| Option | Values |
|---|---|
--variant
|
defaultshadowborderednativebase
|
--color
|
basewhitenaturalprimarysecondarydarksuccesswarningdangerinfosilvermiscdawn
|
--space
|
extra_smallsmallmediumlargeextra_largenone
|
--rounded
|
extra_smallsmallmediumlargeextra_largefullnone
|
--size
|
extra_smallsmallmediumlargeextra_large
|
--type
|
native_selectselect_option_group
|
--module
| A module name of your own |
What it generates
mix mishka.ui.gen.component native_select