Select
A real select underneath, with SutraUI's own list on top: forms, validation and first paint work without JavaScript.
<select>
with the options. The extracted hook hides it and shows a trigger and a list drawn as page markup, so the open list also appears in a screen share. Below 640 px the list is a bottom sheet.
In a form, with errors
<.input type="select">
renders the select with its label, description and errors. Errors appear once a field is used (
used_input?
),
and
aria-invalid
goes to the trigger.
Search
searchable
defaults to
nil
: a search box appears from 10 options on. Force it with
true
or
false
. Letters type-ahead on the field; in the search box they filter.
Groups and disabled options
Multiple
multiple
shows chips in the trigger and keeps the list open while choosing. A multiple select with nothing chosen posts nothing for its field (the browser's rule), so default it in the handler.
Native
native
keeps only the browser's own select, for a page that must work without JavaScript.
Inside a dialog
The open list is a fixed card placed from the trigger, so a dialog body no longer clips it.
Team location
Pick the country the team works from.
Custom option content
For options that need markup (a badge, an icon) build the list with
select_option
.
That form keeps a hidden
<input>
instead of a
<select>
.
Prefer
options
wherever the options are plain text.
Usage Notes
- WAI-ARIA select-only combobox (editable with search) and listbox. Arrows, Home/End, PageUp/PageDown, type-ahead, Enter/Space, Tab and Escape all work.
- The list flips above the field or shifts to stay on screen and scrolls inside the room it has.
-
Merge
phoenix-colocated/sutra_uiinto your LiveSocket so the styled list shows; without it the browser's own select works.