Theme
Install with your agentnpx shadcn@4.23.1 add @goop/trail-select

Select

Free

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

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

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.

Terminal
npx shadcn@4.23.1 add @goop/trail-select
PROMPT
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

  • Each option with its sentence: select--options.md
  • State: value (value / defaultValue / onValueChange); open (open / defaultOpen / onOpenChange); drawn by data-state=open, data-selected=true, data-placeholder
Parts
PartWhat it is
SelectTriggerThe 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
SelectValueThe chosen value's words inside the trigger, cut with an ellipsis when the field is narrower; its props: select--value.md
SelectValueMediaThe 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
SelectValueDescriptionMuted words after the value, such as a note that the chosen option is the default one
SelectIconThe trailing chevron that says the field opens a choice; its children replace the chevron
SelectContentThe select's open LIST; its props: select--content.md
SelectItemOne option of the select's list; its props: select--item.md
SelectGroupA 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 ShortcutKeys).
  • 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

KeyWhat it does
ArrowDown ArrowUpMove highlight
EnterChoose highlighted
EscapeDismiss

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

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
checkedthe attribute aria-checked=true
expandedthe attribute data-state=open
openthe attribute data-state=open
highlightedthe attribute data-selected=true
disabledthe prop disabled
invalidthe attribute aria-invalid
placeholder-shownthe attribute data-placeholder

Motion

  • The part sets its own motion: add no transition or animation of your own.
  • How the theme moves, and how to move your own parts the same way: Motion.

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.

goop.so/themes/trail/components/select.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add @goop/trail-select

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.