# Select

> A themed dropdown for choosing one option.

- Category: [Inputs & forms](https://tarve.dev/docs.md#inputs)
- Import: `import { Select } from "@tarve/core";`
- Props type: `SelectProps`
- Source: [packages/core/src/select.ts:23](https://github.com/omarcosr/tarve/blob/main/packages/core/src/select.ts#L23)

## Usage

```tsx title="Select.tsx"
import { Select } from "@tarve/core";

let role = "developer";

<Select
  id="role"
  value={role}
  options={[
    { value: "developer", label: "Developer" },
    { value: "designer", label: "Designer" },
    { value: "manager", label: "Manager" },
  ]}
  onValueChange={(value) => {
    role = value;
  }}
  style={{ width: 240 }}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` (required) | `string` | — |  |
| `options` (required) | `readonly SelectOption[]` | — |  |
| `disabled` | `boolean` | `false` |  |
| `glass` | `GlassProp` | — | Liquid Glass capsule trigger and glass list. |
| `onOpenChange` | `(open: boolean) => void` | — |  |
| `onValueChange` | `(value: string) => void` | — |  |
| `open` | `boolean` | — |  |
| `placeholder` | `string` | `"Select an option"` |  |
| `value` | `string` | — |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="GlassProp"
type GlassProp = boolean | GlassVariant | GlassOptions;
```

```ts title="SelectOption"
interface SelectOption { value: string; label: string; disabled?: boolean }
```

Previous: [RadioGroup](https://tarve.dev/docs/components/RadioGroup.md) · Next: [NativeSelect](https://tarve.dev/docs/components/NativeSelect.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/Select · Index for agents: https://tarve.dev/llms.txt
