Forms
NativeSelect
Styled native <select> with placeholder and select types.
import { NativeSelect } from "datui";Playground
<NativeSelect placeholder="Choose…" selectType="default" status="default" />Examples
Select types
Accessibility
- Native
<select>semantics and picker; the placeholder is a disabled, hidden first option. - Labelling and
aria-invalidcome from FormItem or your own props.
API
NativeSelect
Styled native `<select>`; the platform picker opens on touch devices. `ref` points at the select.
| Prop | Type | Default | Description |
|---|---|---|---|
| align | TextAlign | left | |
| before | ReactNode | — | Content before the control, usually an icon. |
| className | string | — | |
| defaultValue | string | number | — | |
| icon | ReactNode | <DropdownIcon /> | Trailing icon. |
| onChange | ((event: ChangeEvent<HTMLSelectElement, Element>, value: string) => void) | — | Native change event plus the new value for convenience. |
| placeholder | string | — | Text shown while nothing is selected (a disabled, hidden first option). |
| selectType | SelectType | default | `default` bordered field, `plain` borderless, `accent` borderless with accent text. |
| slotProps | { root?: (FormFieldProps & { ref?: Ref<HTMLDivElement>; }); } | undefined | — | Props for the FormField shell. `className` and `style` also go to the shell. |
| status | FormFieldStatus | "default" | Visual validation state. Pair `error` with `aria-invalid` on the control (FormItem does this). |
| value | string | number | — | Selected option value; `null` shows the placeholder. |