# Native Select

A native HTML select styled with Zenos form surfaces and browser-native behavior.

Native Select styles the platform `<select>` while preserving native keyboard interaction, form submission, validation, and mobile selection interfaces. Use [Select](/components/select/) when you need a custom popup, animation, or richer option content.

```tsx
import { Field, NativeSelect, NativeSelectOption } from "@zentara-co/zenos-ui";

function NativeSelectExample() {
  return (
    <Field.Root className="w-full max-w-sm">
      <Field.Label>Environment</Field.Label>
      <NativeSelect defaultValue="production" name="environment">
        <NativeSelectOption value="development">Development</NativeSelectOption>
        <NativeSelectOption value="staging">Staging</NativeSelectOption>
        <NativeSelectOption value="production">Production</NativeSelectOption>
      </NativeSelect>
      <Field.Description>
        Uses the browser and operating system selection interface.
      </Field.Description>
    </Field.Root>
  );
}
```

## Import

```tsx
import { NativeSelect, NativeSelectOptGroup, NativeSelectOption } from "@zentara-co/zenos-ui";
```

## Usage

```tsx
<NativeSelect defaultValue="production" name="environment">
  <NativeSelectOption value="development">Development</NativeSelectOption>
  <NativeSelectOption value="staging">Staging</NativeSelectOption>
  <NativeSelectOption value="production">Production</NativeSelectOption>
</NativeSelect>
```

`value`, `defaultValue`, and `onChange` follow the native React select contract. The visible selected text comes from the matching option label, while form submission uses its `value`.

## Variants

Native Select shares the form-control surfaces used by Input and Select: `default`, `filled`, and `none`.

```tsx
import { NativeSelect, NativeSelectOption, Stack } from "@zentara-co/zenos-ui";

function NativeSelectVariantsExample() {
  return (
    <Stack gap="3" className="w-full max-w-sm">
      {(["default", "filled", "none"] as const).map((variant) => (
        <NativeSelect key={variant} variant={variant} aria-label={`${variant} native select`}>
          <NativeSelectOption value="">{variant}</NativeSelectOption>
          <NativeSelectOption value="active">Active</NativeSelectOption>
        </NativeSelect>
      ))}
    </Stack>
  );
}
```

## Groups

Use `NativeSelectOptGroup` to label related options. Native grouping and disabled options remain available to browsers and assistive technology.

```tsx
import { Field, NativeSelect, NativeSelectOptGroup, NativeSelectOption } from "@zentara-co/zenos-ui";

function NativeSelectGroupsExample() {
  return (
    <Field.Root className="w-full max-w-sm">
      <Field.Label>Deployment region</Field.Label>
      <NativeSelect defaultValue="singapore">
        <NativeSelectOptGroup label="Asia Pacific">
          <NativeSelectOption value="singapore">Singapore</NativeSelectOption>
          <NativeSelectOption value="sydney">Sydney</NativeSelectOption>
        </NativeSelectOptGroup>
        <NativeSelectOptGroup label="Europe">
          <NativeSelectOption value="frankfurt">Frankfurt</NativeSelectOption>
          <NativeSelectOption value="london" disabled>
            London — unavailable
          </NativeSelectOption>
        </NativeSelectOptGroup>
      </NativeSelect>
    </Field.Root>
  );
}
```

## Disabled and invalid

Native Select inherits `disabled`, `required`, invalid state, labels, descriptions, and errors from `Field.Root`. These states also remain available as native select attributes.

```tsx
import { Field, Grid, NativeSelect, NativeSelectOption } from "@zentara-co/zenos-ui";

function NativeSelectStatesExample() {
  return (
    <Grid columns={{ base: 1, md: 2 }} gap="4" className="w-full max-w-2xl">
      <Field.Root disabled>
        <Field.Label>Managed workspace</Field.Label>
        <NativeSelect defaultValue="engineering">
          <NativeSelectOption value="engineering">Engineering</NativeSelectOption>
        </NativeSelect>
        <Field.Description>This value is managed by your organization.</Field.Description>
      </Field.Root>
      <Field.Root invalid required>
        <Field.Label>Region</Field.Label>
        <NativeSelect defaultValue="">
          <NativeSelectOption value="" disabled>
            Select a region
          </NativeSelectOption>
          <NativeSelectOption value="apac">Asia Pacific</NativeSelectOption>
          <NativeSelectOption value="emea">Europe, Middle East, and Africa</NativeSelectOption>
        </NativeSelect>
        <Field.Error>A region is required.</Field.Error>
      </Field.Root>
    </Grid>
  );
}
```

## Sizes and density

Set `size="sm | md | lg"` to match neighboring controls. Without an explicit size, compact density uses `sm` and comfortable density uses `md`.

## RTL

The indicator uses logical inline positioning, so it moves to the correct edge in right-to-left layouts. Option text and the browser's selection interface follow the nearest HTML `dir` value.

## Variants

default, filled, none

## Sizes

sm, md, lg

## Anatomy

```text
NativeSelect
NativeSelectOption
NativeSelectOptGroup
```

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| value / defaultValue | string \| string[] | — | Native controlled or initial selected value. |
| onChange | ChangeEventHandler<HTMLSelectElement> | — | Receives the native select change event. |
| size | sm \| md \| lg | md | Visual control height; compact density defaults to `sm`. |
| variant | default \| filled \| none | default | Form-control surface treatment. |
| wrapperClassName | string | — | Classes applied to the relative wrapper that positions the icon. |
| disabled / required / name / multiple | native select props | — | Preserves browser validation, submission, and selection behavior. |
| NativeSelectOption | OptionHTMLAttributes<HTMLOptionElement> | — | Native option with a stable slot and theme-aware colors. |
| NativeSelectOptGroup | OptgroupHTMLAttributes<HTMLOptGroupElement> | — | Native labeled option group. |
| native props | SelectHTMLAttributes<HTMLSelectElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and the select ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

Associate Native Select with `Field.Label` or an accessible label. Keep the first placeholder option disabled when it is not a valid choice, and use `required` for native validation. Avoid replacing option labels with color alone; native option styling varies between browsers and operating systems.

Source: https://zenos-ui.pages.dev/components/native-select/