Select

Dropdown select on Radix Select with groups, labels, separators and default and small triggers.

Installation

pnpm dlx shadcn@latest add @ward/select

Add the Ward registry to components.json once:

"registries": {
  "@ward": "https://ward.so/r/{name}.json"
}

Or install from the URL with no configuration: npx shadcn@latest add https://ward.so/r/select.json

Usage

import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from "@/components/ui/select";
<Select defaultValue="recent" onValueChange={(value) => console.log(value)}>
  <SelectTrigger className="w-48">
    <SelectValue placeholder="Sort by" />
  </SelectTrigger>
  <SelectContent>
    <SelectGroup>
      <SelectLabel>Sort by</SelectLabel>
      <SelectItem value="recent">Most recent</SelectItem>
      <SelectItem value="name">Name</SelectItem>
    </SelectGroup>
    <SelectSeparator />
    <SelectItem value="random">Random</SelectItem>
  </SelectContent>
</Select>

Props

PropTypeDefaultDescription
valuestring-Value of the selected item, when the parent controls it.
defaultValuestring-Value of the item that starts selected when the select is uncontrolled.
onValueChange(value: string) => void-Called when another item is selected.
disabledbooleanfalseDim the select and stop it opening.
SelectTrigger size"default" | "sm""default"Height of the trigger.
SelectValue placeholderReactNode-Text shown while nothing is selected.
SelectContent position"item-aligned" | "popper""item-aligned"Line the selected item up over the trigger, or open below it like a menu.
SelectItem valuestring-Value the item reports when it is selected; it cannot be empty.
SelectItem disabledbooleanfalseDim the item and stop it being selected.

Ward · Version 1.0.0 · Registry manifest