mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-02 17:08:39 +00:00
57 lines
946 B
Plaintext
57 lines
946 B
Plaintext
---
|
|
title: Select
|
|
description: Displays a list of options for the user to pick from—triggered by a button.
|
|
component: true
|
|
featured: true
|
|
radix:
|
|
link: https://www.radix-ui.com/docs/primitives/components/select
|
|
api: https://www.radix-ui.com/docs/primitives/components/select#api-reference
|
|
---
|
|
|
|
<ComponentPreview name="select-demo" />
|
|
|
|
## Installation
|
|
|
|
<Steps>
|
|
|
|
### Command
|
|
|
|
```bash
|
|
npx shadcn-ui add select
|
|
```
|
|
|
|
### Usage
|
|
|
|
```tsx
|
|
import {
|
|
Select,
|
|
SelectContent,
|
|
SelectItem,
|
|
SelectTrigger,
|
|
SelectValue,
|
|
} from "@/components/ui/select"
|
|
```
|
|
|
|
```tsx
|
|
<Select>
|
|
<SelectTrigger className="w-[180px]">
|
|
<SelectValue placeholder="Theme" />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
<SelectItem value="light">Light</SelectItem>
|
|
<SelectItem value="dark">Dark</SelectItem>
|
|
<SelectItem value="system">System</SelectItem>
|
|
</SelectContent>
|
|
</Select>
|
|
```
|
|
|
|
</Steps>
|
|
|
|
---
|
|
|
|
## Examples
|
|
|
|
### Form
|
|
|
|
<ComponentPreview name="select-form" />
|