# Select
URL: /docs/ui/select
A dropdown select component with composable sub-components.
import { PreviewCode } from "@/components/docs/preview-code.server";
import {
SelectSample,
SelectDisabledItemsSample,
SelectPlaceholderSample,
SelectDisabledSample,
SelectGroupsSample,
SelectVariantsSample,
SelectSizesSample,
SelectScrollableSample,
} from "@/components/docs/samples/select";
This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
Installation \[#installation]
Usage \[#usage]
```tsx
import { Select } from "@/components/assistant-ui/select";
const options = [
{ value: "apple", label: "Apple" },
{ value: "banana", label: "Banana" },
{ value: "orange", label: "Orange" },
];
export function FruitPicker() {
const [value, setValue] = useState("apple");
return (
);
}
```
Examples \[#examples]
Variants \[#variants]
Use the `variant` prop on `SelectTrigger` to change the visual style.
```tsx
// Border (default)
// No border
// Solid background
```
Sizes \[#sizes]
Use the `size` prop on `SelectTrigger` to change the height.
```tsx
// 36px (default)
// 32px
```
Scrollable \[#scrollable]
Long lists automatically become scrollable.
Groups \[#groups]
Use the composable API for grouped options:
Disabled Items \[#disabled-items]
With Placeholder \[#with-placeholder]
Disabled Select \[#disabled-select]
API Reference \[#api-reference]
Composable API \[#composable-api]
| Component | Description |
| ------------------------ | ----------------------------------------------------------------------- |
| `Select` | A convenience component that renders a complete select with options. |
| `SelectRoot` | The root component that manages state. |
| `SelectTrigger` | The button that opens the dropdown. Accepts `variant` and `size` props. |
| `SelectValue` | Renders the selected value or placeholder. |
| `SelectContent` | The dropdown content container with animations. |
| `SelectItem` | An individual selectable item. |
| `SelectGroup` | Groups related items together. |
| `SelectLabel` | A label for a group of items. |
| `SelectSeparator` | A visual separator between items or groups. |
| `SelectScrollUpButton` | Scroll indicator for long lists. |
| `SelectScrollDownButton` | Scroll indicator for long lists. |
Select \[#select]
A convenience component that renders a complete select with options.
void",
required: true,
description: "Callback when the selected value changes.",
},
{
name: "options",
type: "SelectOption[]",
required: true,
description: "Array of options to display.",
},
{
name: "placeholder",
type: "string",
description: "Placeholder text when no value is selected.",
},
{
name: "className",
type: "string",
description: "Additional CSS classes for the trigger.",
},
{
name: "disabled",
type: "boolean",
description: "Whether the select is disabled.",
},
]}
/>
SelectOption \[#selectoption]
SelectTrigger \[#selecttrigger]
The button that opens the dropdown.
Style Variants (CVA) \[#style-variants-cva]
| Export | Description |
| ----------------------- | ------------------------------------- |
| `selectTriggerVariants` | Styles for the select trigger button. |
```tsx
import { selectTriggerVariants } from "@/components/assistant-ui/select";
```