NativeSelect
The browser's own select, styled like Input, with options as data or as option/optgroup children, a placeholder, two sizes and the Field label, description and invalid state.
Code
import { Field, FieldLabel, NativeSelect } from "@fadymondy/nasaq/web";export function Country() { return ( <Field> <FieldLabel>Country</FieldLabel> <NativeSelect name="country" defaultValue="" required placeholder="Choose a country" options={[ { value: "eg", label: "Egypt" }, { value: "sa", label: "Saudi Arabia" }, ]} /> </Field> );}Forms · beta
Live examples and controls: NativeSelect in the lab.
Install
npx shadcn@latest add https://docs.nasaqui.com/r/native-select.jsonA styled <select>. Phones open their own wheel or sheet, it posts with plain HTML forms, and it is light.
When to use
- Mobile-first forms and long plain lists (countries, time zones).
- Server forms that must work without JavaScript.
When not to use
- Options with icons, descriptions or search: use
SelectorCombobox. - Several values: use
Comboboxwith multiple, or checkboxes.
Import
import { NativeSelect } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"Quick start
import { Field, FieldLabel, NativeSelect } from "@fadymondy/nasaq/web";
export function Country() {
return (
<Field>
<FieldLabel>Country</FieldLabel>
<NativeSelect
name="country"
defaultValue=""
required
placeholder="Choose a country"
options={[
{ value: "eg", label: "Egypt" },
{ value: "sa", label: "Saudi Arabia" },
]}
/>
</Field>
);
}Anatomy
NativeSelect data-slot="native-select" (wrapper)
├─ select Field control: gets the label, description and invalid state
│ ├─ option value="" the placeholder (disabled when required)
│ └─ options / children
└─ ChevronDown at the inline endAPI
NativeSelect: every select prop except size, plus:
| Prop | Type | Default | Description |
|---|---|---|---|
options | readonly NativeSelectOption[] | { value, label, disabled? }. Or pass option / optgroup children. | |
placeholder | string | A first empty option. With required it cannot be picked again. | |
size | "sm" | "md" | "md" | Control height. |
className goes on the wrapper; the other props go on the select.
Accessibility
- It is a real
select: keyboard, screen readers and autofill work as the platform does. - Inside
Field,FieldLabelnames it andFieldErrordescribes it. - Text is 16px on touch screens so iOS does not zoom.
RTL & i18n
- The chevron sits at the inline end and the padding mirrors. Option text follows the page direction.
Styling & tokens
- Same height, border, radius and focus ring as
Input(h-control,rounded-control,--nq-focus).
Do / Don't
- Do use a placeholder like "Choose…" with
requiredinstead of preselecting a wrong value. - Don't use it for fewer than four options: radios show the choice without a click.
Related
Lab
https://docs.nasaqui.com/?path=/docs/components-forms-native-select--docs
LimitsEditor
A per-resource limits form where each row is a number, Unlimited or Inherit, with optional price, overage price, per-key rate limit and spend cap, validation and change tracking.
OtpInput
One-time-code entry with N boxes; paste fills every box, Backspace steps back, digits stay left-to-right in RTL.