# Select

Displays a list of options for the user to pick from—triggered by a button.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).





<ComponentPreview name="select-demo">
  <SelectDemo />
</ComponentPreview>

## Installation [#installation]

<Tabs defaultValue="cli">
  <TabsList>
    <TabsTrigger value="cli">
      CLI
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add https://shadcn-cssinjs.com/r/select.json
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Install the following dependencies:
      </Step>

      ```bash
      pnpm add @base-ui/react @stylexjs/stylex
      ```

      <Step>
        Make sure [StyleX is configured](/docs/installation) and the design tokens are
        installed.
      </Step>

      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource name="select" title="select.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</Tabs>

## Usage [#usage]

```tsx
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select/select";
```

```tsx
<Select>
  <SelectTrigger>
    <SelectValue placeholder="Theme" />
  </SelectTrigger>
  <SelectContent>
    <SelectItem value="light">Light</SelectItem>
    <SelectItem value="dark">Dark</SelectItem>
  </SelectContent>
</Select>
```

## Composition [#composition]

Use the following composition to build a `Select`:

```txt
Select
├── SelectTrigger
│   └── SelectValue
└── SelectContent
    └── SelectGroup
        ├── SelectLabel
        ├── SelectItem
        └── SelectSeparator
```

## Examples [#examples]



### Align Item With Trigger [#align-item-with-trigger]

Use `alignItemWithTrigger` on `SelectContent` to align the selected item with
the trigger.

<ComponentPreview name="select-align-item">
  <SelectAlignItem />
</ComponentPreview>

### Groups [#groups]

<ComponentPreview name="select-groups">
  <SelectGroups />
</ComponentPreview>

### Scrollable [#scrollable]

<ComponentPreview name="select-scrollable">
  <SelectScrollable />
</ComponentPreview>

### Disabled [#disabled]

<ComponentPreview name="select-disabled">
  <SelectDisabled />
</ComponentPreview>

### Invalid [#invalid]

<ComponentPreview name="select-invalid">
  <SelectInvalid />
</ComponentPreview>



## RTL [#rtl]

To enable right-to-left support, see the [RTL guide](/docs/rtl).

<ComponentPreview name="select-rtl" direction="rtl">
  <SelectRtl />
</ComponentPreview>

## API Reference [#api-reference]

See the [Base UI](https://base-ui.com/react/components/select#api-reference) documentation for the full API.
