# Select

> Select dropdown for React and shadcn that opens with the chosen option over its trigger, like a macOS pop-up button.

A select that opens with the chosen row over its trigger and grows from that row, or drops 4px below on touch. The highlight glides on the snappy spring.

- Tier: Free (MIT)
- Interaction: Select
- Page: https://eased.dev/components/select
- Installs: @base-ui/react, motion
- Registry: https://eased.dev/r/select.json

## Install

```bash
npx shadcn add https://eased.dev/r/select.json
```

A pop-up list for choosing one value (or several) from a short, known set, built on Base UI Select, the Eased floating layer and the overlay core's rows, in the same bordered shell as Input.

## When to use

- Picking from a fixed set of up to about 15 options: a region, a timezone, a member's role.
- Settings forms where the value should read like text in a field, not like a button.
- A same-width control per row of a list (a role column), so every row lines up (R102).

## When not to use

- Long lists, or lists people search: use [Combobox](/components/combobox).
- Two to four options that should all stay visible: use [Segmented](/components/segmented) or [Radio Group](/components/radio-group).
- Actions rather than values: use a Dropdown Menu.

## Usage

```tsx example.tsx
import { Field } from "@/components/eased/field/field";
import { Select } from "@/components/eased/select/select";

const regions = [
  { label: "Americas", items: [{ value: "us-east", label: "US East (Virginia)" }, { value: "us-west", label: "US West (Oregon)" }] },
  { label: "Europe", items: [{ value: "eu-west", label: "EU West (Dublin)" }, { value: "eu-central", label: "EU Central (Frankfurt)" }] },
];

export function Example() {
  return (
    <Field label="Data region" name="region">
      <Select items={regions} defaultValue="eu-west" />
    </Field>
  );
}
```

## Examples

### Composed rows

Compose rows when they need more than `items` describes; `SelectItem` takes an `icon` and a `description`.

```tsx
<Select defaultValue="growth" aria-label="Plan">
  <SelectItem value="starter">Starter</SelectItem>
  <SelectItem value="growth" description="$99 a month">Growth</SelectItem>
  <SelectSeparator />
  <SelectGroup label="Annual">
    <SelectItem value="growth-yearly">Growth, yearly</SelectItem>
  </SelectGroup>
</Select>
```

### A role column

Give every row's select the same track so roles start on one x.

```tsx
<ul className={`${rowGrid} [--col:7rem]`}>
  <li className={rowGridRow}>
    <Avatar name="Jonas Lindqvist" />
    <span>Jonas Lindqvist</span>
    <Select items={roles} size="sm" value={role} onValueChange={setRole} aria-label="Role for Jonas Lindqvist" />
  </li>
</ul>
```

## API reference

### Select

| Prop | Type | Default | Description |
|---|---|---|---|
| `items` | `SelectOption<V>[] \| SelectOptionGroup<V>[]` | | Options, flat or grouped (`{ label, items }`). Groups are separated by a rule. |
| `children` | `ReactNode` | | `SelectItem`, `SelectGroup`, `SelectSeparator`, when `items` is not set. |
| `value` / `defaultValue` | `V \| V[] \| null` | | Controlled / uncontrolled value (an array with `multiple`). |
| `onValueChange` | `(value, details) => void` | | |
| `multiple` | `boolean` | `false` | Choose several; the trigger lists them, comma-separated. |
| `placeholder` | `ReactNode` | | Muted text while nothing is chosen. |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | 32, 36 or 40px, like Input. |
| `invalid` | `boolean` | | Invalid outside a Field; inside one, the field's validity drives it. |
| `disabled` | `boolean` | `false` | |
| `name` | `string` | | Submits the value with a form. |
| `alignItemWithTrigger` | `boolean` | `true` | Open with the chosen row over the trigger. Base UI falls back to a list below on touch or without room. |
| `renderValue` | `(value) => ReactNode` | | Formats the trigger's value. |
| `aria-label` | `string` | | The trigger's name when no label names it. |
| `container` | `HTMLElement \| null` | `document.body` | Portal target. |
| `zIndex` | `number` | `50` | Raise inside a higher layer. |
| `className` | `string` | `""` | The shell; set a width here (it fills its container). |
| `popupClassName` | `string` | `""` | The popup. |

`SelectOption<V>` is `{ value, label, icon?, description?, disabled? }`. Every other Base UI `Select.Root` prop passes through (`open`, `onOpenChange`, `required`, `readOnly`, `modal`, `form` …).

### SelectItem, SelectGroup, SelectSeparator

`SelectItem`: `value`, `children`, `label` (typeahead text when children aren't plain text), `icon`, `description`, `disabled`. `SelectGroup`: `label`, `children`. `SelectSeparator`: a full-bleed rule.

## Keyboard

| Key | Action |
|---|---|
| `Enter` / `Space` / `↓` / `↑` | Opens the list with the chosen row highlighted. |
| `↓` / `↑` / `Home` / `End` | Moves the highlight. |
| Letters | Typeahead to the next matching row. |
| `Enter` / `Space` | Chooses the highlighted row and closes. |
| `Esc` / `Tab` | Closes without changing the value. |

## Accessibility

- The trigger is a button with `aria-haspopup="listbox"`; it is named by a Field label, `aria-labelledby` or `aria-label`.
- Rows are `option`s in a `listbox`, `aria-selected` on the chosen ones; group labels name their groups.
- Focus moves into the list on open and returns to the trigger on close.
- Inside a Field, the trigger carries the field's description and error, and the shell turns red and shakes once when it becomes invalid.
- Rows are 40px on coarse pointers; the scroll arrows don't render on touch, where the list scrolls natively.

## Motion

With the chosen row over the trigger (Base UI's `data-side="none"`), the popup grows from that row at 0.97 with no travel: `transform-origin` is the row's centre. When it falls back to a list below, it enters 4px down toward the trigger like every Eased listbox. Opacity fades in 150ms on the enter curve while scale rides the snappy spring; the exit fades in 100ms, scales half as far and never overshoots, and because both are transitions a close mid-open reverses. The highlight is one shared-layout fill that glides between rows on the snappy spring; the list is a Motion scroll container (`layoutScroll`), so the glide stays on target while the list scrolls under it. The check draws in on the snappy spring. Reduced motion keeps a 100ms fade and moves the highlight without travel.

## Notes for AI

Pick Select for a short, fixed set of values in a form; pick Combobox when people would rather type. Pass `items` (flat or `{ label, items }` groups) and `defaultValue` or `value`/`onValueChange`; inside a Field, label it with the Field (or `FieldLabel nativeLabel={false} render={<div />}`), otherwise give `aria-label`.

Don't wrap it in another bordered box or put it inside an Input: it is its own shell. Don't add a check, chevron, highlight or scroll handling: the rows, the glide, the scroll arrows and the align-with-trigger positioning are built in.

## Related

- [Combobox](/components/combobox): the same rows with a text filter, chips for several values.
- [Input](/components/input): the shell this matches.
- [Segmented](/components/segmented): two to four options, all visible.

## Example

`components/eased/select/select-demo.tsx`

```tsx
"use client";

import { useState } from "react";
import { FieldLabel, FieldRoot } from "../_primitives/field/field";
import { teamMembers, type Member } from "../_primitives/fixtures/saas";
import { Avatar } from "../avatar/avatar";
import { DemoFrame } from "../lib/demo-frame";
import { rowGrid, rowGridRow } from "../lib/layout";
import { Select, type SelectOption, type SelectOptionGroup } from "./select";

const REGIONS: SelectOptionGroup<string>[] = [
  {
    label: "Americas",
    items: [
      { value: "us-east", label: "US East (Virginia)" },
      { value: "us-west", label: "US West (Oregon)" },
      { value: "sa-east", label: "South America (São Paulo)" },
    ],
  },
  {
    label: "Europe",
    items: [
      { value: "eu-west", label: "EU West (Dublin)" },
      { value: "eu-central", label: "EU Central (Frankfurt)" },
    ],
  },
  {
    label: "Asia Pacific",
    items: [
      { value: "ap-southeast", label: "Singapore" },
      { value: "ap-northeast", label: "Tokyo" },
      { value: "ap-south", label: "Sydney", disabled: true, description: "Opens in January" },
    ],
  },
];

const ZONES = [
  "Pacific/Honolulu",
  "America/Los_Angeles",
  "America/Denver",
  "America/Chicago",
  "America/New_York",
  "America/Sao_Paulo",
  "Europe/London",
  "Europe/Berlin",
  "Europe/Helsinki",
  "Asia/Dubai",
  "Asia/Kolkata",
  "Asia/Singapore",
  "Asia/Tokyo",
  "Australia/Sydney",
];

// "Berlin (GMT+2)", from Intl, on the fixtures' date so the offsets don't drift with DST.
const offsetOf = (timeZone: string) =>
  new Intl.DateTimeFormat("en-US", { timeZone, timeZoneName: "shortOffset" })
    .formatToParts(Date.UTC(2026, 9, 18, 14, 30))
    .find((p) => p.type === "timeZoneName")?.value ?? "GMT";

const TIMEZONES: SelectOption<string>[] = ZONES.map((zone) => ({
  value: zone,
  label: `${zone.split("/")[1].replace(/_/g, " ")} (${offsetOf(zone)})`,
}));

const ROLES: SelectOption<Member["role"]>[] = [
  { value: "Owner", label: "Owner" },
  { value: "Admin", label: "Admin" },
  { value: "Member", label: "Member" },
  { value: "Viewer", label: "Viewer" },
];

export function SelectDemo() {
  const [members, setMembers] = useState(() => teamMembers.slice(0, 3));

  return (
    <DemoFrame title="Workspace settings" meta="Orbit">
      <div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto px-(--pad) py-5">
        <div className="grid grid-cols-1 gap-4 @sm:grid-cols-2">
          <FieldRoot name="region">
            <FieldLabel nativeLabel={false} render={<div />}>
              Data region
            </FieldLabel>
            <Select items={REGIONS} defaultValue="eu-west" />
          </FieldRoot>
          <FieldRoot name="timezone">
            <FieldLabel nativeLabel={false} render={<div />}>
              Timezone
            </FieldLabel>
            <Select items={TIMEZONES} defaultValue="Europe/Berlin" />
          </FieldRoot>
        </div>

        <section className="flex flex-col gap-1.5">
          <h3 className="text-ui font-medium text-text">Members</h3>
          {/* --col is the role column: every role select has one width and one x (R102, R108). */}
          <ul className={`${rowGrid} gap-x-3 [--col:7rem]`}>
            {members.map((m) => (
              <li key={m.id} className={`${rowGridRow} h-11`}>
                <Avatar name={m.name} size="md" />
                <span className="flex min-w-0 flex-col">
                  <span className="truncate text-ui-sm text-text">{m.name}</span>
                  <span className="truncate text-ui-xs text-text-muted">{m.email}</span>
                </span>
                <Select
                  items={ROLES}
                  size="sm"
                  value={m.role}
                  disabled={m.role === "Owner"}
                  aria-label={`Role for ${m.name}`}
                  onValueChange={(role) => role && setMembers((list) => list.map((x) => (x.id === m.id ? { ...x, role } : x)))}
                />
              </li>
            ))}
          </ul>
        </section>
      </div>
    </DemoFrame>
  );
}
```
