Select
A drop-down list of options.
Forms
Added in v0.76.3
Updated
Default
{ui field, name: 'status', label: 'Status'}
{ui select,
name: 'status',
options: ['draft' => 'Draft', 'review' => 'In review', 'live' => 'Live'],
value: 'review',
/}
{/ui}
options is a list of key and title pairs, and value is the key of the chosen one. Put it in a field for a label, a hint and an error. It takes required, disabled, invalid, class and attrs like the other controls.
Placeholder
{ui field, name: 'country', label: 'Country'}
{ui select,
name: 'country',
placeholder: 'Choose one',
options: ['ca' => 'Canada', 'nz' => 'New Zealand', 'za' => 'South Africa'],
/}
{/ui}
placeholder adds an empty first option with that text, so nothing is chosen until the user picks one.