---
title: "Native Select"
description: "Native Select with accessible presentation and local state."
---

# Native Select

Native Select with accessible presentation and local state.

## Installation

Install the shared package once in your Exact app. This version is a beta.

```sh
bun add --exact @rightui/ui@0.4.0-beta.4
```

Or choose another package manager:

```sh
npm install --save-exact @rightui/ui@0.4.0-beta.4
pnpm add --save-exact @rightui/ui@0.4.0-beta.4
yarn add --exact @rightui/ui@0.4.0-beta.4
```

Exact compilation uses Bun 1.4.2. Register Geist and Newsreader, declare the font marker and add the root provider using [Installation](/docs/installation).

### Manual source setup

Install an editable copy of the complete package:

```sh
mkdir -p vendor/rightui vendor/rightui-ui
npm pack @rightui/ui@0.4.0-beta.4 --pack-destination vendor/rightui
tar -xzf ./vendor/rightui/rightui-ui-0.4.0-beta.4.tgz -C vendor/rightui-ui --strip-components=1
bun add file:./vendor/rightui-ui
```

Keep package.json, the Contract files, ui.tamber, assets and licenses together.

### Import

```contract
use NativeSelect from "@rightui/ui"
```

## Usage

Import NativeSelect from @rightui/ui. Store its value in state and update it through the provided action callback.

## Example

```contract
use FontWeights from "@rightui/ui"
use uiFontFamily, NativeSelect from "@rightui/ui"

component Demo
  props
    width: number
    reduced: bool
  inject
    uiWeights: FontWeights
    uiFont: string
  derive narrow = width < 600
  state language = "English"
  action changeLanguage(value: string)
    language = value
  view
    column gap="ui.space-16" min-width=0 max-width="100%"
      NativeSelect(id="controls-native", label="Language", options=["English", "English", "العربية"], value=language, disabled=false, change=changeLanguage)
      text "Disabled" font-size="ui.text-sm" font-weight=uiWeights.semibold font-family=uiFontFamily(uiFont) data-rightui-font="body"
      NativeSelect(id="variation-native-select-disabled", label="Language", options=["English", "English", "العربية"], value=language, disabled=true, change=changeLanguage)

```

## API Reference

| Property | Type |
| --- | --- |
| NativeSelect.id | string |
| NativeSelect.label | string |
| NativeSelect.options | string[] |
| NativeSelect.value | string |
| NativeSelect.disabled | bool |
| NativeSelect.change | action |

## Source

File: packages/ui/native-select.contract

```contract
use FontWeights from "./typography-context.contract"
use uiFontFamily from "./typography-context.contract"
component NativeSelect
  props
    id: string
    label: string
    options: string[]
    value: string
    disabled: bool
    change: action
  inject
    uiWeights: FontWeights
    uiFont: string
  view
    column gap="ui.space-8" min-width="0px"
      text label id=(id + "-label") font-size="ui.text-sm" font-weight=uiWeights.medium color="ui.foreground" font-family=uiFontFamily(uiFont) data-rightui-font="body"
      select id=id testId=id value=value change=change disabled=disabled aria-labelledby=(id + "-label")
        min-height="ui.space-36" padding="ui.space-8 ui.space-12" border-width="ui.border-width" border-style="solid" border-color="ui.border" border-radius="ui.radius-control" background-color="ui.surface" color="ui.foreground" font-size="ui.text-sm"
        for item in options key=item
          option value=item
            text item font-family=uiFontFamily(uiFont) data-rightui-font="body"

```
