Skip to content
HomeCobalt

Select

Picks one of up to 10 known options and sends it with the form.

Examples

A labelled select that shows its placeholder until a room is chosen, then the room's name.
Countries with their flagsEach option and the chosen value lead with the country's flag.

Domicile

In a fieldThe field's label names the trigger, and its description says what the choice changes.

Fund assets and fees are shown in this currency.

Variants

Bookings

Small--control-sm tall, for a toolbar or a table row.

States

Make someone else the owner before changing this role.

DisabledDisabled through the Field: it keeps its value at half opacity, does not open, and says why.
Choose a room for the meeting.
InvalidA red wash on the trigger, with the Field's error linked to it until a room is chosen.
OverflowTen options, the most a Select takes; where the screen is short, the list scrolls inside the popup with an arrow at each end.

Usage

Use it when

  • You pick one of 5 to 10 known options, such as a role, a city or a time zone.
  • The options are nouns that need no typing to find, and the pick goes into a form.

Use something else when

  • 2 to 4 options that fit in one row. Use SegmentedControl instead.
  • The choice is on or off. Use Switch instead, or Checkbox inside a form.
  • You may pick several. Use a column of Checkbox rows instead.
  • The options are actions, not a value. Use DropdownMenu instead.
  • More than 10 options, or options you find by typing. Use Combobox instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/select.json
import { Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectItem } from "@/components/cobalt/ui/select"