# Select

Single-selection dropdown built on Radix Select. Trigger sizes (`xs` to `lg`) match `Input`, and the floating listbox portals to `body` with popper width matching.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| size | "xs" \| "sm" \| "md" \| "lg" | "md" | Trigger height, corner radius, horizontal padding, and chevron icon size. |
| aria-invalid | boolean \| "true" \| "false" | false | Switches the trigger border to --destructive; wired automatically inside Field. |
| disabled | boolean | false | Disables the trigger using step 3 background and step 8 text without opacity. |
| position | "popper" \| "item-aligned" | "popper" | Positions SelectContent directly below SelectTrigger at matching width. |
| name | string | — | Submits the selected value in native HTML forms via FormData. |

## Sizes and tokens

| Tier / Role | Token | Value |
| --- | --- | --- |
| xs | --control-height-xs / --control-icon-xs | 24px height · radius-sm (4px) · 16px chevron · 16px text |
| sm | --control-height-sm / --control-icon-sm | 32px height · radius-sm (4px) · 16px chevron · 16px text |
| md | --control-height-md / --control-icon-md | 40px height · radius-md (8px) · 20px chevron · 16px text |
| lg | --control-height-lg / --control-icon-lg | 48px height · radius-md (8px) · 24px chevron · 16px text |
| Popup surface | --popover / --popover-foreground / --shadow-md / --z-dropdown | Step 3 surface · 1px border · shadow-md (light) · z-index 20 |
| Highlighted item | --secondary-hover | Neutral step 4 background on keyboard or pointer highlight |

## Code

```tsx
import {
  Field,
  Select,
  SelectContent,
  SelectGroup,
  SelectItem,
  SelectLabel,
  SelectSeparator,
  SelectTrigger,
  SelectValue,
} from "@freshgemui/monoplinth";

export function Example() {
  return (
    <Field label="Brand theme" description="Applied to primary accents." required>
      <Select name="theme" defaultValue="verdigris">
        <SelectTrigger>
          <SelectValue placeholder="Choose theme" />
        </SelectTrigger>
        <SelectContent>
          <SelectGroup>
            <SelectLabel>Mineral</SelectLabel>
            <SelectItem value="mono">Mono</SelectItem>
            <SelectItem value="porphyry">Porphyry</SelectItem>
          </SelectGroup>
          <SelectSeparator />
          <SelectGroup>
            <SelectLabel>Metal</SelectLabel>
            <SelectItem value="verdigris">Verdigris</SelectItem>
            <SelectItem value="brass">Brass</SelectItem>
          </SelectGroup>
        </SelectContent>
      </Select>
    </Field>
  );
}
```

## Do and don't

- **Do: Use groups and labels for long option lists** — Organize related options with SelectGroup, SelectLabel, and SelectSeparator so users can scan choices quickly.
- **Don't: Rely on color alone for the selected option** — Always keep the leading Check indicator in SelectItem so selection is clear without color perception.

## Accessibility

- `SelectTrigger` reads `id`, `aria-describedby`, `aria-invalid`, and `aria-required` from the nearest `Field` context automatically.
- `Enter`, `Space`, and `ArrowDown` open the listbox; `ArrowUp` and `ArrowDown` move highlight; `Enter` selects and closes.
- Selected options render a Lucide `Check` icon alongside text (WCAG 1.4.1).
- Disabled triggers use step 3 background and step 8 text with no opacity reduction.

## Rationale

Aligning `SelectTrigger` to the exact `--control-height-*`, `--control-radius-*`, and `16px` text scale of `Input` lets text inputs and selects sit side by side in forms without vertical misalignment.
