Docs menu

Select

A raised pill trigger that presses down while its puffy menu is open. Pick an option and a heart flies from it back to the trigger, which wobbles as it lands.

Installation

❯ npx shadcn@latest add https://yan.moe/r/select.json

Usage

tsx
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select"
tsx
<Select>
  <SelectTrigger className="w-56">
    <SelectValue placeholder="Pick a flavour" />
  </SelectTrigger>
  <SelectContent>
    <SelectItem value="sakura">Sakura</SelectItem>
    <SelectItem value="matcha">Matcha</SelectItem>
  </SelectContent>
</Select>

Group options with SelectGroup, SelectLabel and SelectSeparator, as in the demo above.

Accessibility

  • Built on Radix Select: arrow keys, typeahead, Home/End and Escape all work, and focus returns to the trigger.
  • Give the trigger an aria-label when there is no visible label.
  • With prefers-reduced-motion: reduce, the menu appears without the bounce and no heart flies.

API

PropTypeDefault
intensity

Set on Select. kawaii: the menu pops and a heart flies back to the trigger. subtle: the menu fades. off: it just appears.

"kawaii" | "subtle" | "off""kawaii"
position

Set on SelectContent. How the menu is placed relative to the trigger.

"popper" | "item-aligned""popper"
value / defaultValue

Set on Select. Controlled and uncontrolled value.

string-
onValueChange

Set on Select. Called when an option is chosen.

(value: string) => void-