StorybookGitHub

Select

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

Installation

npx shadcn@latest add https://reactdocs.canceydejean.dev/r/select.json

Usage

Use the Base UI select for accessible single choice from a list. Compose trigger, value, content, and items.

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

export function Example() {
  return (
    <Select defaultValue="apple">
      <SelectTrigger className="w-[180px]">
        <SelectValue placeholder="Select a fruit" />
      </SelectTrigger>
      <SelectContent>
        <SelectItem value="apple">Apple</SelectItem>
        <SelectItem value="banana">Banana</SelectItem>
        <SelectItem value="blueberry">Blueberry</SelectItem>
      </SelectContent>
    </Select>
  );
}

Group options with SelectGroup + SelectLabel. Control with value / onValueChange (or the Base UI equivalents your version exposes).