datui
Color scheme

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-invalid come from FormItem or your own props.

API

NativeSelect

Styled native `<select>`; the platform picker opens on touch devices. `ref` points at the select.

PropTypeDefaultDescription
alignTextAlignleft
beforeReactNode—Content before the control, usually an icon.
classNamestring—
defaultValuestring | number—
iconReactNode<DropdownIcon />Trailing icon.
onChange((event: ChangeEvent<HTMLSelectElement, Element>, value: string) => void)—Native change event plus the new value for convenience.
placeholderstring—Text shown while nothing is selected (a disabled, hidden first option).
selectTypeSelectTypedefault`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.
statusFormFieldStatus"default"Visual validation state. Pair `error` with `aria-invalid` on the control (FormItem does this).
valuestring | number—Selected option value; `null` shows the placeholder.