Select
The HvSelect
component is a form control for choosing an option from a list.
It aligns with the native <select>
and <option>
APIs, making it easy to integrate into forms.
If you need a search filter or multi-select checkboxes, consider using
HvDropdown
instead.
Options
In addition to HvOption
children, HvSelect
also supports an options
propβan array of objects with value
and label
.
For more flexibility (e.g., using HvOptionGroup
or custom rendering), use HvOption
as children instead.
Form
To use HvSelect
in a form, provide a name
prop.
By default, the submitted value will be the selected optionβs value
, or a JSON string of selected values in multi-select mode.
You can customize the submitted value using the getSerializedValue
prop.
Controlled
The value and open states of HvSelect
can be controlled by using the value
/onChange
and open
/onOpenChange
props respectively.