GitHubGitHub
← All components
Forms / component

Combobox

A multi-select input with chips, keyboard cursor, backspace-to-remove, selection limits, and async lookup hooks.

ChipsLimit reachedLoadingEmpty
<Combobox options={people} bind:value maxSelected={4} placeholder="Invite teammates…" />

Installation

pnpm add @chanrg/4ui

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

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

Usage

import { Combobox } from '@chanrg/4ui';<Combobox options={people} bind:value maxSelected={4} placeholder="Invite teammates…" />

API reference

Props

PropTypeDefaultDescription
optionsSelectOption[][]Available options.
valuestring[] ($bindable)[]Selected values.
maxSelectednumberSelection cap.
onquery(query) => voidAsync lookups: fetch and update options yourself.
loadingbooleanfalseAsync spinner row.

CSS variables

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

Accessibility

  • Chips expose labelled remove buttons.
  • Backspace with an empty query removes the last chip.

Dependencies

Icon, dismiss/portal/floating primitives