1. Docs
  2. Components
  3. Select

Select

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

Installation

Copy and paste the following code into your project.

Update the import paths to match your project setup.

Usage

Single import

import { Select } from "~/components/ui/select";
<Select.Root>
  <Select.Trigger />
 
  <Select.Popover>
    <Select.Content items={fruits}>
      {(item) => (
        <Select.Item id={item.id} textValue={item.name}>
          {item.name}
          <Icons.Check className="size-0 opacity-0 group-selected:size-4 group-selected:opacity-100" />
        </Select.Item>
      )}
    </Select.Content>
  </Select.Popover>
</Select.Root>

Multiple imports

import {
  SelectContent,
  SelectItem,
  SelectPopover,
  SelectRoot,
  SelectTrigger,
} from "~/components/ui/select";
<SelectRoot>
  <SelectTrigger />
 
  <SelectPopover>
    <SelectContent items={fruits}>
      {(item) => (
        <SelectItem id={item.id} textValue={item.name}>
          {item.name}
          <Icons.Check className="size-0 opacity-0 group-selected:size-4 group-selected:opacity-100" />
        </SelectItem>
      )}
    </SelectContent>
  </SelectPopover>
</SelectRoot>

Examples

Unselectable

With Label

Choose a fruit

Form

Choose a fruit