AutocompleteArrayInput

A multi-select autocomplete for choosing several values.

Installation

pnpm dlx shadcn@latest add @chelone/autocomplete-array-input
Loading preview…

A multi-select autocomplete for choosing several values.

Props

PropTypeDefaultDescription
alwaysOnboolean—As a `<FilterForm>`/`<FilterButton>` filter: always shown, never in the add-filter menu. Read off the element by the filter layer, never by the input.
defaultValueNoInfer<SourceValue<TRecord, TPath>>—Input-level default, ra precedence (seeds only into an untouched hole). Typed as the value at `source`; `unknown` without a record.
disabledboolean—Native disabled state.
helperTextReactNode—Helper text rendered below the input; a string is translated.
idstring—Explicit element id; a generated `useId` value is used otherwise.
isRequiredboolean—Forces the required marker; ORed with `required()` detection on `validate`.
labelReactNode—The input label. A string is translated; a ReactNode renders as-is; `false` (or `""`) renders no label.
namestring—Legacy field-name alias (ra parity); the wiring uses `source`.
onBlur(event: unknown) => void—Chained AFTER the blur is recorded.
onChange(eventOrValue: unknown) => void—Chained AFTER the parsed value is written to the form.
parse(value: unknown) => NoInfer<SourceTransformValue<TRecord, TPath>>—Write transform (input value → stored value). Must return the value at `source`; `unknown` without a record.
readOnlyboolean—Native read-only state.
resourcestring—Override the ambient resource (used to resolve the default label key).
typestring—The DOM input `type` (text inputs default to `"text"`).
validateValidator | readonly Validator[]—ra-contract validators — composed, first error wins.
sourceTPath—The field path RELATIVE to the ambient source scope.
classNamestring—
clearOnBlurboolean—When true, clear the filter text on input blur.
debouncenumber—
emptyTextstring—Accepted for API parity; not rendered in the array variant.
filterToQuery(searchText: string) => FilterPayload—
handleHomeEndKeysboolean—When true, Home/End keys scroll the listbox to first/last item.
inputText(choice: TChoice) => string—Custom display text for badge labels.
isOptionEqualToValue(option: ChoiceValueOf<TChoice>, value: ChoiceValueOf<TChoice>) => boolean—Custom equality check between a choice value and a selected value.
limitChoicesToValueboolean—When true, only show already-selected choices in the dropdown.
matchSuggestion(filter: string, choice: TChoice) => boolean—Custom filter function; replaces default substring match.
modalboolean—Radix popover modality.
noOptionsTextReact.ReactNode—Content to show when no choices match the filter.
openOnFocusboolean—When true, open the dropdown on input focus (default for the array variant).
placeholderstring—
selectOnFocusboolean—When true, select all text in the input on focus.
setFilter(filter: string) => void—Called with the current filter text on every keystroke (no debounce).
shouldRenderSuggestions(filter: string) => boolean—Gate controlling whether the dropdown opens at all.
suggestionLimitnumber—Cap the number of dropdown items shown.