8bit

Search docs

Search for a docs page

Select

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

Installation

pnpm dlx shadcn@latest add https://8bit.cnlibs.com/r/select.json

Usage

import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select";
<Select defaultValue="apple">
  <SelectTrigger className="w-40">
    <SelectValue placeholder="Select a fruit" />
  </SelectTrigger>
  <SelectContent>
    <SelectItem value="apple">Apple</SelectItem>
    <SelectItem value="banana">Banana</SelectItem>
    <SelectItem value="blueberry">Blueberry</SelectItem>
    <SelectItem value="grapes">Grapes</SelectItem>
  </SelectContent>
</Select>

Grouped

Group related items with SelectGroup and SelectLabel.