# NativeSelect

> A compact select with native-feeling keyboard behaviour.

- Category: [Inputs & forms](https://tarve.dev/docs.md#inputs)
- Import: `import { NativeSelect } from "@tarve/core";`
- Props type: `NativeSelectProps`
- Source: [packages/core/src/form-controls.ts:289](https://github.com/omarcosr/tarve/blob/main/packages/core/src/form-controls.ts#L289)

## Usage

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

let size = "m";

<NativeSelect
  id="size"
  value={size}
  placeholder="Size"
  options={[
    { value: "s", label: "Small" },
    { value: "m", label: "Medium" },
    { value: "l", label: "Large" },
  ]}
  onValueChange={(value) => {
    size = value;
  }}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` (required) | `string` | — |  |
| `options` (required) | `readonly SelectOption[]` | — |  |
| `disabled` | `boolean` | — |  |
| `onOpenChange` | `(open: boolean) => void` | — |  |
| `onValueChange` | `(value: string) => void` | — |  |
| `open` | `boolean` | — |  |
| `placeholder` | `string` | — |  |
| `value` | `string` | — |  |

## Common props

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

## Types

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

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

---

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