vaiperui

components / select

Select

Accessible combobox with keyboard navigation, type-to-search and a detailed style with an icon/description per option.

How to use

Accessible combobox (`role="combobox"` + `listbox`) with keyboard navigation, typeahead and controlled or uncontrolled selection. Enable `searchable` to filter by text and `variant="detailed"` for options with `leading` and `description`.

preview
Select.tsx
import { Select } from "vaiperui";
<Select
label="Country"
placeholder="Choose a country"
searchable
options={[
{ value: "br", label: "Brazil" },
{ value: "us", label: "United States" },
{ value: "pt", label: "Portugal" },
]}
/>

Colors

preview
primary
success
warning
danger
colors.tsx
<Select variantColor="primary" label="Country" options={options} />
<Select variantColor="success" label="Country" options={options} />
<Select variantColor="warning" label="Country" options={options} />
<Select variantColor="danger" label="Country" options={options} />

Styles

`detailed` enlarges the trigger and the options, with a `leading` slot and a `description` per item.

preview
default
detailed
styles.tsx
<Select variant="default" label="Country" options={options} />
<Select variant="detailed" label="Country" options={options} />

Sizes

preview
sm
md
lg
sizes.tsx
<Select size="sm" label="Country" options={options} />
<Select size="md" label="Country" options={options} />
<Select size="lg" label="Country" options={options} />

Radius

preview
none
sm
md
lg
full
radius.tsx
<Select radius="none" label="Country" options={options} />
<Select radius="sm" label="Country" options={options} />
<Select radius="md" label="Country" options={options} />
<Select radius="lg" label="Country" options={options} />
<Select radius="full" label="Country" options={options} />

`searchable` adds a field to filter the options by text.

preview
searchable
searchStyle full
no search
search.tsx
<Select searchable label="Country" options={options} />
<Select searchable searchStyle="full" label="Country" options={options} />
<Select label="Country" options={options} />

States

`disabled` blocks the whole select. An option with `disabled: true` appears blocked and cannot be chosen.

preview
disabled option
disabled
states.tsx
<Select label="Country" options={options} disabled />
const options = [
{ value: "br", label: "Brazil" },
{ value: "pt", label: "Portugal", disabled: true },
]

Custom color

`customColor` overrides `variantColor` and paints focus, border and highlight from a single color.

preview
orange
green
violet
custom-color.tsx
<Select customColor="#ff6600" label="Country" options={options} />
<Select customColor="#22c55e" label="Country" options={options} />
<Select customColor="#a78bfa" label="Country" options={options} />

Props

PropValuesDefaultDescription
optionsSelectOption[]—List of options ({ value, label, disabled?, description?, leading? })
value / defaultValuestring—Controlled / uncontrolled
onValueChange(value: string) => void—Fired when an option is selected
placeholderstring"Select an option"Text shown when nothing is selected
emptyMessagestring"No options found"Text when there are no options
noResultsMessage(query: string) => string(query) => `No results for "${query}"`Text when a search has no matches; receives the typed query
searchablebooleanfalseShows a search field inside the menu to filter by text
searchPlaceholderstring"Search..."Search field placeholder
clearSearchLabelstring"Clear search"Accessible name of the button that clears the search
searchStyle"boxed" | "full""boxed"`boxed`: inset, rounded field. `full`: the field spans the whole top of the menu, with a divider
variantdefault | detaileddefaultdefault: compact single-line dropdown. detailed: larger trigger and options, with leading and description per option and a tint on the selected one
variantColorprimary | success | warning | dangerprimaryFocus color, open border and option highlight
customColorvalid CSS color | { light, dark }—Overrides variantColor: paints focus, border and highlight from a single color, or from a { light, dark } object
sizesm | md | lgmdHeight of the trigger and the options
radiusnone | sm | md | lg | fullmdRounding of the trigger and the menu
animationnone | smooth | fast | bouncesmoothMenu transition
disabledbooleanfalseDisables the whole select
namestring—Mirrors the value into an <input type="hidden"> for form submission
label / aria-label / id / className / stylestring / string / string / string / CSSProperties—Label above the trigger, accessible name when there is no label, and layout props
option.leading / option.descriptionReactNode / string—Visual slot (flag, icon, avatar) before the text, and a second line per option. The slot works in both variants; the description only renders with variant="detailed"