Select

A select displays a collapsible list of options and allows a user to select one of them.

Theme 
Favorite Animal
 
 
selectionMode 
isDisabled 
Example
Select.tsx
Select.css
import {Select, SelectItem} from './Select';

<Select label="Favorite Animal">
  <SelectItem>Aardvark</SelectItem>
  <SelectItem>Cat</SelectItem>
  <SelectItem>Dog</SelectItem>
  <SelectItem>Kangaroo</SelectItem>
  <SelectItem>Panda</SelectItem>
  <SelectItem>Snake</SelectItem>
</Select>

Content

Select reuses the ListBox component, following the Collection Components API. It supports ListBox features such as static and dynamic collections, sections, disabled items, links, text slots, asynchronous loading, etc. See the ListBox docs for more details.

The following example shows a dynamic collection of items, grouped into sections.

Preferred fruit or vegetable
import {Select, SelectItem} from './Select';
import {ListBoxSection, Header} from './ListBox';
import {Collection} from 'react-aria-components/Collection';

function Example() {
return ( <Select label="Preferred fruit or vegetable" items={options}> {section => ( <ListBoxSection id={section.name}> <Header>{section.name}</Header> <Collection items={section.children}> {item => <SelectItem id={item.name}>{item.name}</SelectItem>} </Collection> </ListBoxSection> )} </Select> ); }