ComponentsSelect

Select

The `HvSelect` component is a form control element that allows selection from a list of options. It aims to be aligned with the native HTML `<select>` and `<option>` APIs and be easily integrated with forms.

GitHub LogoSource Code

Options

As an alternative to the HvOption children, HvSelect supports passing an options array of options (with value and label).

Keep in mind that the children is more flexible, as it allows using HvOptionGroup and distinct label and rendering (children) values.

Form

To integrate HvSelect in a form, make sure you’re giving it a name. The value result will be the selected option’s value, or a JSON of the selected values when multi-select is enabled. The value can be customized via the getSerializedValue prop.


Controlled

The value and open states of HvSelect can be controlled by using the value/onChange and open/onOpenChange props respectively.