# Native Select

The browser's own select, styled like the kit's fields. Phones open their own picker.

Section: Components / Inputs
Page: https://ui.heyramzi.com/components/native-select
Import path: `@heyramzi/ui/shadcn/native-select`

## Import

```ts
import * as NativeSelect from "@heyramzi/ui/shadcn/native-select";
```

## Usage

```svelte
<NativeSelect.Root bind:value={status} aria-label="Status">
  <NativeSelect.Option value="todo">To do</NativeSelect.Option>
  <NativeSelect.Option value="done">Done</NativeSelect.Option>
</NativeSelect.Root>
```

## Demo

```svelte
<script lang="ts">
	import * as NativeSelect from "@heyramzi/ui/shadcn/native-select";

	let status = $state("todo");
</script>

<div class="flex flex-col items-center gap-4">
	<NativeSelect.Root bind:value={status} aria-label="Status" class="w-45">
		<NativeSelect.Option value="todo">To do</NativeSelect.Option>
		<NativeSelect.Option value="doing">In progress</NativeSelect.Option>
		<NativeSelect.Option value="done">Done</NativeSelect.Option>
	</NativeSelect.Root>

	<NativeSelect.Root size="sm" aria-label="Country" class="w-45">
		<NativeSelect.OptGroup label="Europe">
			<NativeSelect.Option value="fr">France</NativeSelect.Option>
			<NativeSelect.Option value="pt">Portugal</NativeSelect.Option>
		</NativeSelect.OptGroup>
		<NativeSelect.OptGroup label="Americas">
			<NativeSelect.Option value="us">United States</NativeSelect.Option>
			<NativeSelect.Option value="br">Brazil</NativeSelect.Option>
		</NativeSelect.OptGroup>
	</NativeSelect.Root>
</div>
```

## API

### NativeSelect.Root

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `size` | `"sm" \| "default"` | `"default"` |  |
| `ref` | `HTMLSelectElement \| null` | `null` | bindable |
| `value` |  |  | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLSelectAttributes` from `svelte/elements`, except `size`.

### NativeSelect.Option

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLOptionElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLOptionAttributes` from `svelte/elements`.

### NativeSelect.OptGroup

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLOptgroupElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLOptgroupAttributes` from `svelte/elements`.
