Search

Search and select options from a list.

Similar to Select, with searching as the primary interaction. Supports single and multiple selection. leftAddon and rightAddon place a button to the left or right of the field.

Live example

Example controls

Usage

import { Search } from '@prosazhin/pbcomponents';

const options = ['One', 'Two', 'Three', 'Four', 'Five'].map((display, index) => ({
  display,
  value: String(index),
}));

<Search
  options={options}
  placeholder='Placeholder'
/>;

Component API

PropType / variantsPurposeDefault
size's' | 'm's · mComponent size.m
disabledbooleanDisables interaction.false
errorbooleanShows the error state.false
placeholderstringHint in an empty field.—
classNamestringClass of the root element.—
wrapperClassNamestringClass of the outer wrapper.—
valueOption | Option[]Currently selected choice.—
onChange(value: Option | Option[]) => voidCalled when the value changes.—
defaultValueOption | Option[]Initially selected choice.—
optionsOption[]List of searchable choices.—
multiplebooleanAllows multiple values.false
leftAddonReactNodeButton or other element to the left of the field.—
rightAddonReactNodeButton or other element to the right of the field.—
popoverClassNamestringClass of the options list.—
popoverItemClassNamestringClass of an option.—

Native HTML attributes are accepted where the component renders the corresponding element. className props only affect styling.