Select

A component that allows users to select one or more options from a list.

Examples

Helper text and placeholder

The placeholder prop and helperText can both be used to provide additional context for the Select.

Choose your preferred living situation

Controlled state

Optionally use the value prop to control the selected option and onChange to update it.

Invalid state

If the isInvalid prop is set to true, the errorMessage contents will be displayed below the input field, replacing any helperText.

Required information

Disabled option

The isDisabled prop can be used on an individual option to make it unselectable.

API Reference

Select

The main select component, wraps the options and provides the select input.

PropDefaultDescription
label-string

The label for the select field

isInvalid?-boolean

If true, the select will be invalid

isRequired?-boolean

If true the select will be required

isDisabled?-boolean

If true, the select will be disabled

helperText?-string

Text that provides additional guidance to the user

errorMessage?-string

The error message to display if isInvalid is true

onChange?-ChangeEventHandler<HTMLSelectElement>
placeholder?-string

The placeholder for the select. We render an <option/> element that has empty value.

<option value="">{placeholder}</option>

Select.Option

A selectable option to be listed within the <Select />.

PropDefaultDescription
value?-string | number | readonly string[]
isDisabled?-boolean