Skip to content
satin

Combobox

Picks one or more values from a long list by typing to filter it, then Apply.

Creatable

With creatable, a query that no option is exactly ends the list with a Create row. onCreate makes the option, at once or with a promise: the row shows a spinner while it waits and says so if it fails. The new option is picked like any other, as a chip with multiple, waiting for Apply with footer. Here a recruiter adds Framer Motion, which the skills list doesn’t have.

Installation

Terminal
npm i @uisatin/ui
Import
import { Combobox } from '@uisatin/ui/combobox'

About 44.6 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.

First time with Satin? Set it up once, styles and fonts included, with the installation guide.

API Reference

The Combobox component renders a trigger button that opens a panel with a search input (role="combobox"), a listbox of options. Single picks fill the field and close it; multiple picks show as removable chips with Clear. With footer, picks wait for Apply, which stays disabled until something is picked. options can be titled groups (SelectGroup[]). When the app searches: filter={false}, onQueryChange, loading and selectedOptions (picks the results may not hold); renderOption and renderValue draw rows and picks. With creatable, a query no option is exactly ends the list with a Create row; onCreate makes the option (or a promise of it), which is then picked.

PropTypeDefault
options
SelectOption[]SelectGroup[]
—
value
string[]
—
defaultValue
string[]
—
onValueChange
(value: string[]) => void
—
multiple
boolean
false
footer
boolean
false
label
ReactNode
—
hint
ReactNode
—
error
ReactNodeboolean
—
leadingIcon
ReactNode
—
size
"sm""md""lg"
"md"
placeholder
string
—
searchPlaceholder
string
—
emptyText
string
"No results"
applyLabel
string
"Apply"
cancelLabel
string
"Cancel"
clearLabel
string
"Clear"
creatable
boolean{ label?: (query: string) => ReactNode }
false
onCreate
(query: string) => SelectOption | Promise<SelectOption>
—
disabled
boolean
false
open
boolean
—
defaultOpen
boolean
false
onOpenChange
(open: boolean) => void
—
filter
boolean(option, query) => boolean
true
onQueryChange
(query: string) => void
—
loading
boolean
false
loadingText
ReactNode
"Loading"
selectedOptions
SelectOption[]
—
renderOption
(option, { selected }) => ReactNode
—
renderValue
(picked, { remove, disabled }) => ReactNode
—
className
string
—
ref
Ref<HTMLElement>
—
...props
ComponentProps<typeof Popover.Trigger>

Other attributes go to the Radix Popover.Trigger part

—

Accessibility

The field is a button with aria-haspopup="listbox" and aria-expanded, named by label and described by the hint or error (aria-describedby, aria-invalid); it reads out the picks or the placeholder. Opening it moves focus to the search input, a combobox that points at the highlighted option with aria-activedescendant. The list is a listbox (aria-multiselectable with multiple) of options with aria-selected; titled groups are groups named by their headers, and the list is aria-busy while loading. Each chip has a "Remove <label>" button; Clear gives focus back to the field. With creatable, the Create row is the list’s last option, named by the createOption label ("Create “Figma”"); while onCreate waits it is aria-busy and aria-disabled, and a failure is said once from a status region and stays under the row.

KeyAction
EnterorSpaceOn the field: opens the list and focuses the search.
A–ZIn the search: filters the options by label and description.
↑or↓Moves the highlight, wrapping at the ends.
EnterPicks the highlighted option; a single pick closes the list. On the Create row, makes the option and picks it (again after a failure).
TabWith footer, moves to Cancel and Apply.
EscCloses the list, drops picks waiting for Apply and returns focus to the field.