---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Select

One option from a short closed list, for React and Tailwind CSS. Free, MIT.

Free. Its export: `Select`.

## Try it

Choose a period — by the pointer, by searching the list, or by the arrows and Enter — and the figures under it change; a second select sorts them by most or least recorded, or by name; in the third, search a study the list lacks and choose “Create …” to make it. Pick a look to draw both as the small field, the menu field, the pill (and its small form), the property chip or the ghost chip: each opens the same list.

The figures are our own sample numbers held in the page, the same for every study; a study made lives in the page only; the chosen period and order stay as the look changes.

## When to use

- One option from a short closed list.
- Also called: dropdown or picker.

## When not to use

- To type and search a long list, use Combobox.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Select on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/meadow-select
```

```text
Add the Goop Select to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { SelectValueMedia, SelectValueDescription, SelectGroup } from '@/components/ui/goop/select';

import { useState } from 'react';
import {
  Select,
  SelectContent,
  SelectDescription,
  SelectIcon,
  SelectItem,
  SelectSeparator,
  SelectTrigger,
  SelectValue,
} from '@/components/ui/goop/select';
import { ShortcutKey } from '@/components/ui/goop/shortcut-key';

function SitePicker() {
  const [site, setSite] = useState('');
  return (
    <Select value={site} onValueChange={setSite} name="site">
      <SelectTrigger aria-label="Survey site">
        <SelectValue placeholder="Pick a site" />
        <SelectIcon />
      </SelectTrigger>
      <SelectContent aria-label="Survey sites" searchPlaceholder="Find a site">
        <SelectItem value="north">North meadow</SelectItem>
        <SelectItem value="ridge" keywords={['R-7']}>
          Ridge path
        </SelectItem>
        <SelectSeparator />
        <SelectItem value="marsh">
          Marsh edge
          <SelectDescription>Closed in winter</SelectDescription>
        </SelectItem>
      </SelectContent>
    </Select>
  );
}

function ReportLanguage() {
  return (
    <Select defaultValue="en-gb">
      <SelectTrigger variant="ghost" aria-label="Report language">
        <SelectValue />
        <SelectIcon />
      </SelectTrigger>
      <SelectContent aria-label="Languages" search={false}>
        <SelectItem value="en-gb">
          English (UK)
          <ShortcutKey>1</ShortcutKey>
        </SelectItem>
        <SelectItem value="nl">
          Nederlands
          <ShortcutKey>2</ShortcutKey>
        </SelectItem>
        <SelectItem value="de">
          Deutsch
          <ShortcutKey>3</ShortcutKey>
        </SelectItem>
      </SelectContent>
    </Select>
  );
}
```

- Fits: account, board, flow, inbox, record, settings (their recipes).
- height, width, padding, gap, corner, border, background, text, motion: add no class for these.

## API reference

### Parts

- `SelectTrigger` — The closed select a person clicks to choose a value; its props: select--trigger.md
- `SelectValue` — The chosen value's words inside the trigger, cut with an ellipsis when it is narrower; its props: select--value.md
- `SelectValueMedia` — The chosen value's mark before its words, the caller's own (an avatar drawn its own way), in the box the trigger's look takes (14 or 16 px, the icon grey)
- `SelectValueDescription` — Muted words after the value, such as a note that the chosen option is the default one
- `SelectIcon` — The chevron that says the trigger opens a choice
- `SelectContent` — The list the trigger opens; its props: select--content.md
- `SelectDescription` — A row's caption, a second line under its words
- `SelectItem` — One option of the list; its props: select--item.md
- `SelectGroup` — A group of the select's options under its `heading` (the list's group heading)
- `SelectSeparator` — A hairline between options, the list's full width, 3 px from the rows on either side; hidden while searching

- Class recipes (cva): selectTriggerVariants (SelectTrigger)

### SelectContent

The list the trigger opens.

```tsx
import { SelectContent } from '@/components/ui/goop/select';
```

### Options

- noneRowLabel?: string — The words of the row that sets an `optional` select back to none; "No <searchLabel>", else "Clear", by default.
- createLabel?: (words: string) => string — The words of the row offering to create the words searched for (the root's `onCreate`); `Create “<words>”`.
- creatingLabel?: (words: string) => string — The words of the loading row while a create waits; `Creating “<words>”` by default.
- searchPlaceholder?: string — The search field's placeholder words, none by default; they name the field when nothing else does.
- hint?: ReactNode — The key hint at the search field's end (the theme's `ShortcutKey`s).
- search?: boolean = true — The search field shown over the rows (the default) or, `false`, clipped to nothing: typing still filters.
- searchLabel?: string — The search field's name for assistive technology; left out, the trigger's own name.
- empty?: ReactNode — The words the list shows while no row matches, under the field; none by default.
- Also takes: container?: HTMLElement | null

### SelectItem

One option of the list.

```tsx
import { SelectItem } from '@/components/ui/goop/select';
```

### Options

- value: string — The value it picks.
- Also takes: onSelect?: (value: string) => void; disabled?: boolean; keywords?: string[]; submenu?: boolean = false; icon?: IconName; mark?: ReactNode; action?: ReactNode

### Select: every option

```tsx
import { Select } from '@/components/ui/goop/select';
```

### Options

- modal?: boolean = true — Whether the open list holds the focus and hides the page from assistive technology (the default).
- optional?: boolean = false — The value may be none: the list opens with a row at its top ("No priority", `SelectContent`'s `noneRowLabel`) that sets it back to `''`, the trigger's empty look (a chip's dashed outline).
- onCreate?: (words: string) => string | undefined | PromiseLike<string | undefined> — Makes an option from the words a person searched for when no row matches them: the list offers them as its one row ("Create “…”", `SelectContent`'s `createLabel`), and Enter or a click calls this with the words, trimmed.
- Also takes: value?: string; defaultValue?: string; onValueChange?: (value: string) => void; open?: boolean; defaultOpen?: boolean = false; onOpenChange?: (open: boolean) => void; name?: string; required?: boolean; disabled?: boolean; form?: string
- State: value (value / defaultValue / onValueChange); open (open / defaultOpen / onOpenChange); drawn by data-focus-visible, data-state=open, data-placeholder

### SelectTrigger

The closed select a person clicks to choose a value.

```tsx
import { SelectTrigger } from '@/components/ui/goop/select';
```

### Options

- shape: field (default), pill, chip
- size: sm, md (default), lg
- variant: default (default), ghost, menu, filled
- iconOnly?: boolean | 'narrow' = false — A chip as its icon alone: `true` always; `'narrow'` while its row, which must carry the class `@container/chip-row`, is under 672 px.
- Also takes: asChild?: boolean

### SelectValue

The chosen value's words inside the trigger, cut with an ellipsis when it is narrower.

```tsx
import { SelectValue } from '@/components/ui/goop/select';
```

### Options

- mark?: ReactNode — An icon drawn before the value's words whatever the value is (a property's own icon); left out, the chosen option's own `mark` is drawn there, so the mark always matches the value.
- placeholderMark?: ReactNode — The icon beside the `placeholder` while nothing is chosen (a priority's dashed line); none by default.

## Keyboard

- Enter: open the list, the chosen row active
- Space: open the list, the chosen row active
- ArrowDown: open the list, the chosen row active
- typing: filter the open list's rows, the first match active
- ArrowDown / ArrowUp: move the active row
- Home / End: the first or last row active
- Enter: pick the active row, close, the focus back on the trigger
- Escape: close the list, the focus back on the trigger

## Accessibility

- The behaviour layer under the part answers keys, focus and dismissal: never write your own.

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

Shortened to fit: the data-slot values, how each state is put on.

## Related

- [Combobox](/themes/meadow/components/combobox): Pick one value from a list by typing.
- [Shortcut key](/themes/meadow/components/shortcut-key): One keyboard key drawn as a small bordered cap inline in hint text, naming a chord with its neighbours.
- [Multi select](/themes/meadow/components/multi-select): A field holding several values picked from a fixed list.
- [Person select](/themes/meadow/components/person-select): A person picker for an assignee, an owner, reviewers or guests, each person shown with their avatar beside their name.
