Select

Select is an input control that allows users to choose one option from a list.

Select is just a lightweight wrapper around a native HTML Select element.

Consider using Single Select Menu and/or Multi Select Menu as a consistently styled and more powerful alernative.

Import#

import { Select } from '@volue/wave-react';

Examples#

Basic#

Controlled#

Select is a controlled component, meaning that React state drives its value. You need to provide value and onChange properties to "make it work".

With Form Field#

Select should be clearly labeled so it's obvious to users what are they choosing. Optionally, you may want to connect helper text and/or validation feedback message to the select. Thus it is recommended to wrap select inputs with Form Field to create a consistent set of form fields that are accessible to screen reader users.

Placeholder#

You must provide placeholder text when the input does not have an initial value.

Provide a default selected option whenever possible. This reduces the interaction cost by saving the user time and clicks.

Disabled input#

Pass isDisabled prop to the accompanying FormField and it will cascade down to the select input.

You can also pass isDisabled prop directly to Select.

The component can show an option as disabled, by setting the disabled property on the option.

Sizes#

Wave provides two Select sizes ‐ medium and small, with the medium size used by default. All sizes are aligned with sizes of other related components like Button or Text Input.

Size inheritance#

Select automatically inherits size, when placed inside a FormField component.

Responsive#

Select supports responsive syntax for its size property, which means you can change its size based on the viewport.

Multi-sizing#

Wave provides applySizes utility, which lets you specify size "scopes" within your app. All selects within a scope will share the same size unless overwritten on a per-control basis.

Groups#

Group related options together, uses the optgroup element internally.


API Reference#

In addition to the props below, you can pass all React.SelectHTMLAttributes.

Prop
Type
Default
css
StitchesCss
No default value
selectCss
StitchesCss
No default value
isDisabled
boolean
No default value
isReadOnly
boolean
No default value
isRequired
boolean
No default value
validationStatus
enum
No default value
options*
(Option | Group<Option>)[]
No default value
value
string | number
No default value
onChange*
function
No default value
placeholder
string
No default value
size
enum
No default value