--- title: Select description: Displays a list of options for the user to pick from—triggered by a button. base: aria component: true featured: true links: doc: https://react-aria.adobe.com/Select api: https://react-aria.adobe.com/Select#api --- ## Installation Command Manual ```bash npx shadcn@latest add select ``` Install the following dependencies: ```bash npm install react-aria-components ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx showLineNumbers import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" ``` ```tsx showLineNumbers const items = [ { label: "Light", value: "light" }, { label: "Dark", value: "dark" }, { label: "System", value: "system" }, ] ``` ## Composition Use the following composition to build a `Select`: ```text Select ├── SelectTrigger │ └── SelectValue └── SelectContent ├── SelectGroup │ ├── SelectLabel │ ├── SelectItem │ └── SelectItem ├── SelectSeparator └── SelectGroup ├── SelectLabel ├── SelectItem └── SelectItem ``` ## Groups Use `SelectGroup`, `SelectLabel`, and `SelectSeparator` to organize items. ## Scrollable A select with many items that scrolls. ## Disabled ## Invalid Add the `data-invalid` attribute to the `Field` component and the `isInvalid` prop to the `SelectTrigger` component to show an error state. ```tsx showLineNumbers /data-invalid/ /aria-invalid/ Fruit ``` ## Searchable Use the [Autocomplete](https://react-aria.adobe.com/Autocomplete) component from React Aria to add search support. ## RTL To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl). ## API Reference See the [React Aria Select](https://react-aria.adobe.com/Select#api) documentation.