Autocomplete

Autocomplete UI Component

Installation

npm i @synerise/ds-autocomplete
or
yarn add @synerise/ds-autocomplete

Usage

import Autocomplete from '@synerise/ds-autocomplete'
<Autocomplete />

Demo

API

PropertyDescriptionTypeDefault
allowClearShow clear button, effective in multiple mode only.booleanfalse
autoFocusget focus when component mountedbooleanfalse
backfillbackfill selected item the input when using keyboardbooleanfalse
children (for customize input element)customize input elementHTMLInputElement HTMLTextAreaElement React.ReactElement<InputProps>
children (for dataSource)Data source to auto completeReact.ReactElement<OptionProps> Array<React.ReactElement<OptionProps>>-
dataSourceData source for autocompleteDataSourceItemType[]-
dropdownMenuStyleadditional style applied to dropdown menuobject
defaultActiveFirstOptionWhether active first option by defaultbooleantrue
defaultValueInitial selected option.string or string[]-
disabledWhether disabled selectbooleanfalse
filterOptionIf true, filter options by input, if function, filter options against it. The function will receive two arguments, inputValue and option, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded.boolean or function(inputValue, option)true
optionLabelPropWhich prop value of option will render as content of select.stringchildren
placeholderplaceholder of inputstring-
valueselected optionstring or string[] or { key: string, label: string or ReactNode } or Array<{ key: string, label: string or ReactNode }>-
onBlurCalled when leaving the component.function()-
onChangeCalled when select an option or input value change, or value of input is changedfunction(value)-
onFocusCalled when entering the componentfunction()-
onSearchCalled when searching items.function(value)-
onSelectCalled when a option is selected. param is option's value and option instance.function(value, option)-
defaultOpenInitial open state of dropdownboolean-
openControlled open state of dropdownboolean-
onDropdownVisibleChangeCall when dropdown openfunction(open)-
getPopupContainerParent Node which the selector should be rendered to. Default to body. When position issues happen, try to modify it into scrollable content and position it relative.function(triggerNode)document.querySelector(.ant-select-auto-complete)
errorTexterror message, if provided input will be set in error statestring-
labelinput labelstring-
descriptioninput descriptionstring-