Simal UI
Components

SelectField

A dropdown that matches Field and InlineField in height and label treatment, so the three interleave in a form grid without any of them riding high.

Web-only, and the dropdown renders through a portal so it escapes any clipping or stacking context the trigger sits inside.

Three modes share one component: single (checkmark, closes on select), radio (radio circle, closes on select) and multi (checkboxes, stays open, trigger shows removable badges).

Import

import { SelectField } from '@simal/ui/nativewindui';

Props

PropValuesDefaultDescription
options[]Each needs id and label. subtitle adds a second line, disabled blocks selection, and group renders section headers — callers must pre-sort so same-group entries are contiguous.
label"Country"Sits above the trigger. Omit it and the trigger stands alone.
placeholder"Select a country"Shown on the trigger while nothing is selected.
modesingle · radio · multi"single"multi switches value and onSelect to arrays. The other two differ only in affordance.
searchablebooleanfalseAdds a search input inside the dropdown that filters by label. Worth it past roughly ten options.
isLoadingbooleanfalseReplaces the trigger with a spinner. For options still being fetched.
errorTextAny non-empty string turns the label and border red and renders below the trigger.
disabledbooleanBlocks opening and dims the trigger.
value""Controlled. A string in single and radio modes, string[] in multi.
onSelectRequired. Receives the new id, or the full array in multi mode.
onCreateEnables a "Create …" row when a search returns nothing. Should create the entity and resolve to its new id, or null on failure.

Examples

States

Closed triggers only — the dropdown is a portal, so an open one would escape the snapshot frame.

With Subtitles

Subtitles give a second line for disambiguation — two people with the same name, two units with the same code.

In A Grid

Beside an InlineField, which is the pairing the shared 48px height exists for.

On this page