GitHubGitHub
← All components
Forms / component

Select

A single-value combobox with grouped options, search, keyboard cursor, clear, and optional create-from-query.

OpenGroupedSearchableCreatableDisabled
<Select options={regions} bind:value placeholder="Pick a region" clearable />

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { Select } from '@chanrg/4ui';<Select options={regions} bind:value placeholder="Pick a region" clearable />

API reference

Props

PropTypeDefaultDescription
optionsSelectOption[][]value, label, optional group and disabled.
valuestring | null ($bindable)nullSelected value.
searchablebooleanautoSearch input; auto-enables past 7 options.
clearablebooleanfalseClear affordance.
allowCreatebooleanfalseOffer “Create …” for unmatched queries (with oncreate).
onchange(value, option?) => voidSelection callback.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • Combobox/listbox pattern with aria-expanded and aria-selected.
  • Arrow keys move the cursor, Enter selects, Escape closes and restores focus.

Dependencies

Icon, dismiss/portal/floating primitives