InputSelect
InputSelect is a searchable select built on react-select: single, multi or async. It needs a client runtime; for a
native, hydration-free control use Select. onChange always receives an array of
{ value, label } options, even in single mode.Forms
When to use
Usage
Pick a movie
<InputSelect
aria-label="Movie"
placeholder="Pick a movie"
emptyMessage="No movies found"
loadingPlaceholder="Loading…"
options={options}
onChange={([movie]) => setMovie(movie?.value)}
/>Set placeholder, emptyMessage and loadingPlaceholder: their defaults are Portuguese. Other react-select props
pass through; disabling is isDisabled, not disabled. readOnly keeps the menu closed and hides the clear control.
Multi and async
Pick movies
<InputSelect
aria-label="Movies"
isMulti
loadOptions={(query) => fetch(`/api/movies?q=${query}`).then((r) => r.json())}
onChange={setMovies}
/>loadOptions returns a promise of options; the control is disabled and shows loadingPlaceholder while it resolves.
In isMulti mode, onItemSelect fires once per added or removed item with a cancelAction to revert it.
Motion
The menu grows out of the control with the scale motion preset, zeroed under
prefers-reduced-motion. motion="none" opens it instantly. It animates in only: react-select unmounts it on close.
Accessibility
- react-select provides the combobox semantics, keyboard navigation and live announcements.
Fieldlabels the container, not the search input: passaria-label(ininputPropsinside aForm).
Properties
Name
Type
Default
Description
emptyMessagestringnoneisMultibooleannoneSupport multiple selected options
loadingPlaceholderstringnoneloadOptions((inputValue: string) => Promise<OptionType<T>[]>)nonemenuPlacement"auto""bottom""top"noneDefault placement of the menu in relation to the control. 'auto' will flip
when there isn't enough space below the control.
motion"fade""scale""slide-up""slide-down""slide-left""slide-right""collapse""sheet""sheet-top""drawer-left""drawer-right""push-left""push-right""none"'scale'Enter animation of the options menu. The default
`scale` grows the menu out of the control on open (`@starting-style`);
`prefers-reduced-motion` zeroes it centrally. Set `motion="none"` for an
instant open. Enter only: react-select unmounts the menu synchronously on
close. Same prop and vocabulary as `Dropdown`.
namestringnoneName of the HTML Input (optional - without this, no input will be rendered)
onChange((value: OptionType<T>[]) => void)noneonItemSelect((options: ItemSelectOption<any>) => void)noneoptionsOptionType<T>[]nonereadOnlybooleannonerefRef<InputSelectRef>nonesize"expansive""medium""compact""micro"nonestyleCSSPropertiesnonevalueValueType<OptionType<T>>nonevariant"default""success""error"noneSizes read theme.component.inputSelect.size (expansive, medium, compact, micro).