datui
Color scheme

Forms

ChipsSelect

Multi-select with chips and a filterable dropdown, optionally creatable.

import { ChipsSelect } from "datui";

Playground

<ChipsSelect placeholder="Pick colors" selectedBehavior="highlight" closeAfterSelect />

Examples

Basic

  • TypeScript

Creatable

Typed text that matches no option can be added.

Accessibility

  • The input is a role="combobox" with aria-autocomplete="list", aria-expanded and aria-activedescendant; the listbox is aria-multiselectable.
  • Down/Up open the list and move the highlight, Enter adds (or removes an already selected option), Escape closes; typing filters.
  • Chips behave as in ChipsInput: Backspace in the empty input removes the last one, each has a labelled remove button.
  • The empty text is announced through a polite status region.

API

ChipsSelect

Multi-select with chips and a filterable dropdown, optionally creatable. The input is a combobox: Down/Up open and move, Enter picks the highlighted option (or creates), Escape closes. Chips behave as in ChipsInput. `ref` points at the input.

PropTypeDefaultDescription
allowClearButtonbooleanfalseShows a button that removes every chip and the typed text.
beforeReactNode—Content before the control, usually an icon.
chipsListLabelstring"Selected"Accessible name of the chips list.
classNamestring—
clearLabelstring"Clear"
closeAfterSelectbooleantrueClose the dropdown after picking an option.
creatablestring | booleanfalseLets the user add typed text that matches no option. A string sets the label of the "create" row, shown before the quoted text.
defaultInputValuestring
defaultValueChipOption[][]
dropdownAutoWidthboolean—
emptyTextstringNothing found
fetchingbooleanfalse
fetchingLabelstringLoading…
filterFnfalse | ((query: string, option: ChipOption) => boolean)—Custom filter, or `false` to show options as given.
forcePortalboolean—
inputValuestring—Text typed after the chips.
listLabelstringOptionsAccessible name of the listbox.
maxHeightnumber—Caps the field height in px; content scrolls beyond it.
noMaxHeightboolean—
onChange((value: ChipOption[]) => void)—
onChangeStart((event: SyntheticEvent<Element, Event>, option: ChipOption) => void)—Called before an option is added or removed; call `event.preventDefault()` to cancel.
onClose(() => void)—
onInputChange((value: string) => void)—
onOpen(() => void)—
optionsChipOption[][]
placement"top" | "bottom"bottom
removeLabelstring"Remove"Prefix of each chip's remove-button label.
renderChip((props: ChipProps, option: ChipOption) => ReactNode)—Custom chip. Spread the given props onto `Chip` to keep removal working.
renderOption((props: CustomSelectOptionProps, option: ChipOption) => ReactNode)—Custom option row; spread the props onto `CustomSelectOption`.
selectedBehavior"hide" | "highlight"highlight`hide` removes selected options from the list, `highlight` keeps them checked (choosing again removes).
slotProps{ root?: (FormFieldProps & { ref?: Ref<HTMLDivElement>; }); } | undefined—Props for the FormField shell.
statusFormFieldStatus"default"Visual validation state. Pair `error` with `aria-invalid` on the control (FormItem does this).
valueChipOption[]—Chips.