Skip to Content
Zuri
Components

Picker

A dropdown made of our own parts instead of the operating system's, with search, groups and full keyboard support.

Live preview
Theme
Preview width

Use Picker when you want a dropdown that looks and behaves the same on every device. Unlike the Select, which uses the browser's own menu, the Picker draws its list itself, so it matches your theme, can group options, and adds a search box when the list is long.

Choose the Select when the native menu is what you want, for example for very short lists on phones. Choose the Picker for everything else.

Installation

pnpm dlx shadcn@latest add https://components.abdulqadirmsingi.com/r/picker.json

This also installs the Popover, which it is built on.

Usage

import { Picker } from "@/components/ui/picker";

<Picker
  options={[
    { value: "starter", label: "Starter" },
    { value: "team", label: "Team" },
  ]}
  defaultValue="team"
  onValueChange={(plan) => console.log(plan)}
/>

Give it a visible <label htmlFor> and an id, or an aria-label. Pass name to submit the value with a form.

Search and groups

From 8 options up it adds a search box automatically. Options can have a group (listed under a heading) and keywords (extra words the search matches, such as a currency code).

Live preview
Theme
Preview width

Inside a sentence

variant="inline" removes the field styling, so the picker is just underlined text in the font around it. The home page's hero is built with it.

Live preview
Theme
Preview width

Pay in .

Props

It extends the native <button> props (except value, defaultValue, onChange and children) and spreads them onto the trigger button, including ref (React 19).

Props
PropTypeDefaultDescription
options{ value: string; label: string; group?: string; disabled?: boolean; keywords?: string[] }[]–The choices. Required.
valuestring–The chosen value, when controlled.
defaultValuestring–The initial value when uncontrolled.
onValueChange(value: string) => void–Called when an option is chosen.
placeholderstring"Choose…"Shown when nothing is chosen.
searchableboolean | "auto""auto"Show a search box. "auto" shows it from 8 options up.
searchLabelstring"Search"Names the search box and the list. Translate it.
emptyTextstring"No matches"Shown when the search matches nothing.
panelLabelstring"Options"Names the panel that holds the list.
variant"field" | "inline""field"An input-like field, or bare underlined text.
invalidboolean–Marks the field as invalid (aria-invalid and a danger border).
namestring–Submit the value with a form under this name.
disabledboolean–Disable the picker.

Accessibility

  • The trigger is a real <button> with role="combobox", aria-haspopup="listbox" and aria-expanded. It is named by a label, or by aria-label.
  • The list is a listbox of options with aria-selected; the highlighted option is announced through aria-activedescendant, so focus stays in one place.
  • Keys: Enter, Space or the click opens it. Arrow keys move (skipping disabled options), Home and End jump to the ends, Enter chooses, Esc closes, and typing jumps to a match. With a search box, type to filter.
  • Focus returns to the button when it closes. After a mouse click it returns without drawing a focus ring, so no stray border is left behind; after a key press the ring shows as normal.
  • Targets are at least 36px tall. The panel is limited to the space available and scrolls.

Tokens used

--background, --foreground, --muted, --muted-foreground, --border, --control-border, --danger, --ring, --accent, --accent-ink (inline variant), --z-dropdown, --duration-fast, --ease-out.

Known limitations

  • Single choice only. There is no multiple selection and no way to create new options.
  • The whole list is rendered at once. That is fine for a few hundred options; for thousands, filter on the server and pass in the matches.
  • Not tested with a real screen reader or on a real phone; only in a desktop browser and with an automated checker.

On this page