Components

Select

A drop-down field. The trigger is a pencil box with a tick before its chevron; the list is a slip of paper set down over or under it, where the row you are on gets the highlighter and the chosen row is bold with a blue tick. Radix Select underneath: typeahead, keyboard, form value, item-aligned or popper placement.

Install

terminal
npx shadcn@latest add @wobko/select

First time here? Add the registry to components.json first. How to install

Examples

Default

Press it, slide down the list, and the row under the pointer gets the highlighter. Type a letter to jump; the chosen row is bold with a blue tick.

Groups and a long list

Kicker labels, pencil rules between groups, and scroll arrows when the slip runs out of room. Radix's item-aligned placement (the default) lays the chosen row over the field.

Sizes and states

Default and sm, invalid (red pencil box, a bang before the chevron), disabled (dashed, pale) and a disabled row inside the list.

In a form

A controlled select and a native-form select in one form: `name` puts the chosen value in FormData (Radix keeps a hidden native select in sync), `required` blocks the submit.

Demo

Official `select-demo`: a 180 px trigger with a placeholder and one labeled group of fruit. The trigger is a drawn field with a hand-drawn chevron; the list is a slip, the pointed-at row wears the highlighter and the chosen one a felt tick. Type a letter to jump to a fruit. Only addition: an `aria-label` on the trigger, because a placeholder is not a name.

Scrollable

Official `select-scrollable`: twenty-eight time zones in five groups, far taller than the screen allows. The list keeps to the space Radix says is available and scrolls, with a chevron at each end that scrolls it while you hold the pointer over it. Only addition: an `aria-label` on the trigger, because a placeholder is not a name.

API reference

SelectTrigger

The field you press: a `<button role="combobox">` with the Input's pencil box drawn behind it.

PropTypeDefaultDescription
size"default" | "sm""default"36 px or 32 px tall (28 px in calm density).
aria-invalidboolean | "true" | "false"-true draws the red pencil box with a wavy underline and a bang before the chevron.
disabledboolean-Dashed pencil on a pale wash. Not focusable, no hover.
seedstring | number-Pins the hand: the same seed always draws the same box. Default: derived from useId().

SelectContent

The list: a Paper slip that is also the Radix listbox. A CSS sheet, no SVG. The viewport scrolls, not the paper, so the shadow and any tape stay whole. Every Radix Content prop passes through.

PropTypeDefaultDescription
position"item-aligned" | "popper""item-aligned"`item-aligned` lays the chosen row over the value in the field (Radix's default); `popper` opens under (or over) it and matches its width.
align"start" | "center" | "end""center"Alignment against the trigger in popper mode.
stockStockName"slip"What the list is cut from: slip, paper, kraft, sticky-* ...
edgeEdgeSpec"cut"Cut (pure CSS), torn, deckle ... A drawn edge is measured when the list opens.
tiltboolean | numbertrueA small seeded tilt of the sheet; text stays upright.
tape"corner" | "top" | "both" | falsefalseStrips of masking tape holding the slip.

Accessibility

  • The trigger is a role=combobox button with aria-expanded and aria-controls; the list is a role=listbox with role=option items (aria-selected on the chosen one). Radix handles everything else.
  • Enter, Space, ArrowDown and ArrowUp open it. Arrow keys, Home and End move the highlight, letters jump by typeahead, Enter or Space chooses, Escape closes and puts focus back on the trigger.
  • Give the trigger a name with a Label (`htmlFor` + `id`) or `aria-label`; SelectValue's text becomes its value.
  • With `name` (or inside a form) Radix keeps a hidden native select in sync, so the value is in FormData and `required` blocks the submit.
  • The drawing is aria-hidden and never takes the pointer. The highlight does not depend on hue alone: the row also sits on a highlighter shape and the chosen row is bold with a tick. In Windows high contrast the trigger gets a real border.
  • Portalled content repeats the InkProvider's `data-density`, `data-motion` and `data-theme`, and sits above dialogs so a Select inside a Dialog works. Reduced motion shows the list without the slide and zoom.
  • Right-to-left: the chevron cell, the divider tick and the bang move to the start of the field, and the tick of the chosen row follows.

Source

The files the CLI copies into your project.

Loading the source