---
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 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/trail-select
```

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

## Usage

```tsx
import { Select, SelectTrigger, SelectValue, SelectValueMedia, SelectValueDescription, SelectIcon, SelectContent, SelectItem, SelectGroup } from '@/components/ui/goop/select';
import { useState } from 'react';
import { Field } from '@/components/ui/goop/field';

function Priority() {
  const [priority, setPriority] = useState('');
  return (
    <Field label="Priority" orientation="vertical" className="w-full">
      {(control) => (
        <Select value={priority} onValueChange={setPriority} optional>
          <SelectTrigger {...control}>
            <SelectValue placeholder="No priority" />
            <SelectIcon />
          </SelectTrigger>
          <SelectContent searchLabel="Priority">
            <SelectItem value="urgent">Urgent</SelectItem>
            <SelectItem value="high">High</SelectItem>
            <SelectItem value="low">Low</SelectItem>
          </SelectContent>
        </Select>
      )}
    </Field>
  );
}
```

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

## API reference

### Parts

- `SelectTrigger` — The closed select a person clicks to choose a value, edged in the danger colour while marked aria-invalid (as FieldInvalid marks it); its props: select--trigger.md
- `SelectValue` — The chosen value's words inside the trigger, cut with an ellipsis when the field is narrower; its props: select--value.md
- `SelectValueMedia` — The chosen value's icon before its words (its state, its priority, the person), the caller's own, in a 14 px box in a chip and a 16 px one in the ghost chip and the field
- `SelectValueDescription` — Muted words after the value, such as a note that the chosen option is the default one
- `SelectIcon` — The trailing chevron that says the field opens a choice; its children replace the chevron
- `SelectContent` — The select's open LIST; its props: select--content.md
- `SelectItem` — One option of the select's list; its props: select--item.md
- `SelectGroup` — A group of the select's options under its heading (12 px words at weight 500 in grey, 30 px)

- Class recipes (cva): selectTriggerVariants (SelectTrigger)
- data-slot values (to select a part by): select-error, select-icon, select-icon-indicator, select-input-group, select-input-row, select-input-shortcut, select-message, select-status, select-trigger, select-value, select-value-description, select-value-frame, select-value-media, select-value-row

### SelectContent

The select's open LIST.

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

### Options

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

### SelectItem

One option of the select's 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

### 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.
- 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-state=open, data-selected=true, data-placeholder

### SelectTrigger

The closed select a person clicks to choose a value, edged in the danger colour while marked aria-invalid (as FieldInvalid marks it).

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

### Options

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

### SelectValue

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

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

### Options

- mark?: ReactNode — An icon before the value's words whatever the value (a property's own icon); left out, the chosen option's `mark`.
- placeholderMark?: ReactNode — The icon beside the `placeholder` while nothing is chosen.

## Keyboard

- ArrowDown / ArrowUp: move highlight
- Enter: choose highlighted
- Escape: dismiss

## Accessibility

- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
- hover, active, focus, focus-visible, focus-within: the browser's own (:hover, :active, :focus, :focus-visible, :focus-within): write nothing
- checked: the attribute aria-checked=true
- expanded: the attribute data-state=open
- open: the attribute data-state=open
- highlighted: the attribute data-selected=true
- disabled: the prop disabled
- invalid: the attribute aria-invalid
- placeholder-shown: the attribute data-placeholder

## 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.

## Related

- [Combobox](/themes/trail/components/combobox): Pick one value from a long list by typing.
- [Field](/themes/trail/components/field): A form row that ties one control to its label, its description and its error line, as a settings row or a stacked form field.
- [Multi select](/themes/trail/components/multi-select): A field holding several values picked from a fixed list.
- [Person select](/themes/trail/components/person-select): A person picker for an assignee, an owner or reviewers, each person shown with their avatar beside their name.
