Select
Components

Select

Dropdown select: click to open, pick an option, and the trigger label updates.

Props

SelectProps props
PropTypeDefaultDescription
optionsSelectOption[]—Array of { value, label } items.
valuestring—Controlled selected value.
defaultValuestring—Initial uncontrolled value.
onChange(value: string) => void—Change handler, called with the selected value.
placeholderReactNode—Displayed when no option is selected.
size"sm" | "md"—Trigger button size.
caretboolean—Show the chevron caret. Defaults to true.
classNamestring—Applied to the dropdown panel.
triggerClassNamestring—Applied to the trigger button.
renderOption(option: SelectOption, state: { selected: boolean }) => ReactNode—Custom option content. Retains MenuItem semantics, selection highlight, and hover styling.
renderValue(option: SelectOption | null) => ReactNode—Replaces the trigger's contents. Receives null when nothing is chosen yet and the placeholder would otherwise show.

Usage

Select accepts SelectOption entries and manages the open panel, outside-click dismissal, and selected-option highlight.

Basic

Select

Sizes

Select sizes

Custom placeholder

Select with placeholder
ImportTSX
import { Select } from "@solarius/onset";
import type { SelectOption } from "@solarius/onset";

const regions: SelectOption[] = [
  { value: "us-east-1", label: "us-east-1 (N. Virginia)" },
  { value: "us-west-2", label: "us-west-2 (Oregon)" },
];

<Select options={regions} value={value} onChange={setValue} />
<Select options={regions} placeholder="Choose a region..." />
<Select options={regions} size="sm" />