Skip to content
Back to skills

Takeoff Select

ASecurity

`Select` is a fully-keyboard, accessible custom select: state (value, open, disabled, required) lives on the root, the trigger renders the collapsed button, and the content portals a positioned dropdown. **When to use:** Single-choice dropdown pickers where you want a styled, portalled listbox instead of a native `<select>`. Wrap in a `Field` to attach a label, helper text, or error message. Not for free-text or async option filtering — and not a multi-select.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 4, 2026
designreactnode

Works with

  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add turkishtechnology/takeoff-v2 --skill takeoff-select --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Takeoff Select?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Takeoff Select
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/turkishtechnology-takeoff-select/badge)](https://www.skillsdirectory.com/skills/turkishtechnology-takeoff-select)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: takeoff-select
description:
  'Build an accessible custom dropdown Select (combobox/listbox) — the Select
  from @takeoff-ui/react-spar (Takeoff UI / Spar React). Use WHENEVER building,
  adding, importing, styling, or fixing a Select, dropdown, picker, combobox,
  single-choice option list, or form field with selectable options
  (cabin/country/fare pickers, grouped option menus) in a React app that uses
  @takeoff-ui/react-spar / Takeoff / Spar. Covers Select.Trigger,
  Select.Content, Select.Item, groups, separators, sizes, controlled value,
  invalid state, and Field integration.'
---

# Select — @takeoff-ui/react-spar

`Select` is a fully-keyboard, accessible custom select: state (value, open,
disabled, required) lives on the root, the trigger renders the collapsed button,
and the content portals a positioned dropdown.

**When to use:** Single-choice dropdown pickers where you want a styled,
portalled listbox instead of a native `<select>`. Wrap in a `Field` to attach a
label, helper text, or error message. Not for free-text or async option
filtering — and not a multi-select.

## Setup

Requires the Takeoff provider + token CSS mounted once at the app root (see the
`takeoff-ui` skill or the installation docs). Then import:

```tsx
import { Field, Select } from '@takeoff-ui/react-spar';
```

## Compound parts

- `Select.Trigger` — the collapsed combobox button; shows the selected item's
  `label` or `placeholder`, plus a disclosure indicator.
- `Select.Content` — the portalled `role="listbox"` dropdown panel (positioned
  with Floating UI).
- `Select.Viewport` — optional bounded scroll container for long option lists.
- `Select.Search` — filter field above the viewport. Takes focus on open; you
  filter the rendered items with its `value`. With a search, the viewport is the
  listbox, so the items must sit inside `Select.Viewport`.
- `Select.Empty` — what to show once a search matches nothing.
- `Select.Item` — a selectable option; needs a `value` and a `label` (text used
  for typeahead + trigger display).
- `Select.Group` — groups related items under a label.
- `Select.Label` — section heading inside a `Select.Group`.
- `Select.Separator` — visual divider between groups/items. Rendered as a hidden
  presentational node (`role="presentation"`, `aria-hidden`) so the listbox only
  owns options/groups; pass `role="separator"` to restore separator semantics.
- `Select.Arrow` — optional pointer from the panel toward the trigger.
- `Select.Indicator` — standalone disclosure glyph for full render-prop layouts.

## Basic usage

```tsx
<Field className="max-w-90" required>
  <Field.Label>Cabin</Field.Label>
  <Select defaultValue="economy">
    <Select.Trigger placeholder="Pick a cabin" />
    <Select.Content>
      <Select.Item value="economy" label="Economy">
        Economy
      </Select.Item>
      <Select.Item value="business" label="Business">
        Business
      </Select.Item>
      <Select.Item value="first" label="First class">
        First class
      </Select.Item>
    </Select.Content>
  </Select>
  <Field.Description>Select the cabin for this itinerary.</Field.Description>
</Field>
```

## Examples

### Controlled value

```tsx
import { useState } from 'react';

function ControlledSelect() {
  const [value, setValue] = useState('eco');
  return (
    <Select value={value} onChange={setValue}>
      <Select.Trigger placeholder="Pick a fare" />
      <Select.Content>
        <Select.Item value="eco" label="Eco">
          Eco
        </Select.Item>
        <Select.Item value="flex" label="Eco Flex">
          Eco Flex
        </Select.Item>
        <Select.Item value="biz" label="Business">
          Business
        </Select.Item>
      </Select.Content>
    </Select>
  );
}
```

### Sizes

```tsx
<Select size="small">{/* … */}</Select>
<Select size="base">{/* … */}</Select>
<Select size="large">{/* … */}</Select>
```

`size` accepts `'small' | 'base' | 'large'` (default `'base'`).

### Groups, separator, disabled item

```tsx
<Select className="max-w-90" defaultValue="ist">
  <Select.Trigger placeholder="Choose origin" />
  <Select.Content>
    <Select.Group>
      <Select.Label>Türkiye</Select.Label>
      <Select.Item value="ist" label="Istanbul">
        Istanbul
      </Select.Item>
      <Select.Item value="ank" label="Ankara">
        Ankara
      </Select.Item>
    </Select.Group>
    <Select.Separator />
    <Select.Group>
      <Select.Label>Europe</Select.Label>
      <Select.Item value="lhr" label="London Heathrow">
        London Heathrow
      </Select.Item>
      <Select.Item value="fra" disabled label="Frankfurt (unavailable)">
        Frankfurt (unavailable)
      </Select.Item>
    </Select.Group>
  </Select.Content>
</Select>
```

### Searching a long list

```tsx
const [query, setQuery] = useState('');
const visible = AIRPORTS.filter(a =>
  a.name.toLowerCase().includes(query.toLowerCase()),
);

<Select defaultValue="IST">
  <Select.Trigger placeholder="Choose an airport" />
  <Select.Content>
    <Select.Search
      value={query}
      onValueChange={setQuery}
      placeholder="Search airports"
    />
    <Select.Viewport>
      {visible.map(a => (
        <Select.Item key={a.code} value={a.code} label={a.name}>
          {a.name}
        </Select.Item>
      ))}
      {visible.length === 0 ? <Select.Empty>No airports</Select.Empty> : null}
    </Select.Viewport>
  </Select.Content>
</Select>;
```

The query resets to `''` when the list closes. Typing edits the query (no
typeahead); arrows and Enter still pick from the list.

### Invalid state

```tsx
<Select className="max-w-90" invalid>
  <Select.Trigger placeholder="Required field" />
  <Select.Content>
    <Select.Item value="a" label="Option A">
      Option A
    </Select.Item>
    <Select.Item value="b" label="Option B">
      Option B
    </Select.Item>
  </Select.Content>
</Select>
```

### Custom indicator

`Select.Trigger` renders a chevron that flips with the open state by default.
Pass `indicator` a node, a render function `({ isOpen }) => …`, or `false` to
hide it.

```tsx
<Select.Trigger
  placeholder="Custom icon"
  indicator={({ isOpen }) => (isOpen ? '▲' : '▼')}
/>
```

For full layout control, give `Select.Trigger` a render-prop `children` (opts
out of the built-in indicator/value wrapper) and place a standalone
`Select.Indicator`:

```tsx
<Select.Trigger>
  {({ label }) => (
    <>
      <span className="tk-select-value">{label || 'Choose a city'}</span>
      <Select.Indicator>
        {({ isOpen }) => (isOpen ? '▲' : '▼')}
      </Select.Indicator>
    </>
  )}
</Select.Trigger>
```

## Key props

| Prop                                                       | Type                                                | Default                 | Notes                                             |
| ---------------------------------------------------------- | --------------------------------------------------- | ----------------------- | ------------------------------------------------- |
| `value`                                                    | `string`                                            | -                       | Controlled selected value (pair with `onChange`). |
| `defaultValue`                                             | `string`                                            | -                       | Uncontrolled initial value.                       |
| `onChange`                                                 | `(value: string) => void`                           | -                       | Fires when selection changes.                     |
| `size`                                                     | `'small' \| 'base' \| 'large'`                      | `'base'`                | Size scale.                                       |
| `invalid`                                                  | `boolean`                                           | `false`                 | Danger-state styling for validation.              |
| `disabled` / `required` / `readOnly`                       | `boolean`                                           | -                       | Form state; inherited from a wrapping `Field`.    |
| `open` / `defaultOpen`                                     | `boolean`                                           | - / `false`             | Controlled / uncontrolled open state.             |
| `onOpenChange`                                             | `(open: boolean) => void`                           | -                       | Fires when the dropdown opens/closes.             |
| `contentWidth`                                             | `'trigger' \| 'content' \| number \| string`        | `'trigger'`             | How the panel computes its width.                 |
| `Select.Trigger` `placeholder`                             | `React.ReactNode`                                   | -                       | Shown when no value is selected.                  |
| `Select.Trigger` `indicator`                               | `boolean \| ReactNode \| ((s:{isOpen})=>ReactNode)` | `true`                  | Disclosure indicator; `false` hides it.           |
| `Select.Content` `side` / `align`                          | `Side` / `Align`                                    | `'bottom'` / `'center'` | Floating UI positioning.                          |
| `Select.Item` `value` / `label`                            | `string`                                            | -                       | Option value + display/typeahead text.            |
| `Select.Item` `disabled`                                   | `boolean`                                           | `false`                 | Disables the option.                              |
| `Select.Search` `value` / `defaultValue` / `onValueChange` | `string` / `(query: string) => void`                | `''`                    | The query; filter the items with it.              |
| `Select.Search` `aria-label` / `placeholder`               | `string`                                            | `'Search'`              | Field name and placeholder.                       |

Full props, events, data attributes & type definitions: see
`references/full-docs.md`.

## Accessibility

- `Select.Trigger` is a button with `role="combobox"`,
  `aria-haspopup="listbox"`, and `aria-expanded`.
- `Select.Content` is a `role="listbox"` portalled to `document.body` and
  positioned with Floating UI.
- Use `Select.Viewport` when options may overflow. Keep `Select.Arrow` outside
  the viewport so scrolling does not clip it.
- The trigger exposes the selected item's `label` (or `placeholder`) as its
  accessible name; inside a `Field` it also gets `aria-labelledby` from the
  Field label.
- Keyboard: Enter/Space opens or selects; ↓/↑ open and move highlight; Home/End
  jump to first/last; Esc closes without changing selection; typing characters
  does typeahead to the first matching item.
- With `Select.Search`, the field is the combobox (`aria-activedescendant` →
  highlighted option) and the viewport is the listbox; typing edits the query
  and Space / Home / End stay in the field.

## Reference

- Full component docs (Copy page): `references/full-docs.md`
- Live docs: https://v2.takeoffui.com/docs/components/select
- Source: `packages/react-spar/src/components/select/`
- Spar primitive: https://v2.takeoffui.com/headless/docs/Components/Select

Files in this skill

  • SKILL.md11.2 KB
  • references/full-docs.md34.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in design →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.