NativeSelect

Data input

The browser's own <select>, styled as a Zest field: <NativeSelect.Root> with bind:value, and its options given as items or as NativeSelect.Options (grouped in NativeSelect.OptGroups). placeholder adds an empty first option. Inside a Field it takes its id, label, description, error and invalid and disabled state from the Field.

import { NativeSelect } from '@limerdev/zest';
NativeSelect for AI tools (llms.txt)
Use for
A choice in a form that must work without JavaScript or post natively, a long list where the phone's own picker is easier (countries, time zones), a dense table filter.
Don't
Options that need icons, descriptions or search: use Select or Combobox. Several choices at once: use Checkboxes or a Combobox. Two or three options: use a RadioGroup.

Examples

Basic

In a Field, with items and a placeholder. It posts with the form like any select.

Groups

NativeSelect.Option and NativeSelect.OptGroup as children, for grouped options.

States

The Field's invalid and disabled states reach the select.

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

NativeSelect.Root

Prop Type Default Description
items SelectOption[] [] The options, drawn when the select is given no children.
placeholder string undefined A first option with an empty value, shown until the user picks: "Choose a country". It can't be picked again; with required, the form won't submit while it shows.
value bindable string – The chosen option's value. Bindable. It starts on the placeholder, or on the first option when there is none.

NativeSelect.Option

No props of its own beyond the common ones.

NativeSelect.OptGroup

No props of its own beyond the common ones.