Skip to main content

AutocompleteMultiple

AutocompleteMultiple component.

Default

<AutocompleteMultiple
options={[]}
onChange={handleChange}
isError={false}
customSearch={customSearch}
label={'label'}
isDisplayLabel={true}
onIsSearchingChange={handleIsSearchingChange}
/>

Selected/disabled options

<AutocompleteMultiple
options={[
{
id: 6,
label: 'disabled ',
selected: true,
disabled: true
}
]}
/>
Sélectionner
Sélectionner

Error

<AutocompleteMultiple
isError={true}
options={[
{
id: 1,
label: 'Adrien',
selected: true
}
]}
/>
Sélectionner
Sélectionner
const VALUES = [
{
label: 'Have props',
test: 'test',
code: 'un code',
value: 999
},
{
label: 'Adam'
},
{
label: 'Julian'
},
{
label: 'Mohamed'
}
];

const handleChange = (list) => {
setListSelected(list);
};

const customSearch = (text, list) => {
return list.filter((l) => l?.label?.startsWith('A'));
};

return (
<AutocompleteMultiple
options={VALUES}
onChange={handleChange}
customSearch={customSearch}
/>
);
Custom search
Sélectionner
List Selected :
[]

Disaply label

<AutocompleteMultiple
isDisplayLabel={false}
options={[
{
id: 1,
label: 'Adrien',
selected: true
}
]}
/>
Sélectionner

onIsSearchingChange

<AutocompleteMultiple
onIsSearchingChange={(isSearching) => {
console.log('ISSEARCHING', isSearching);
}}
options={[
{
id: 1,
label: 'Adrien',
selected: true
}
]}
/>
Sélectionner
Sélectionner

Props

NameTypeRequiredDefaultDescription
onChangefunctionNo(list)=>{}Return list of options, triggered on every selection list selected
labelstringNoSelectionnezTop label in input
customSearchfunctionNo(text, list)=>{} : arrayApply custom filter, return new array must contains at least array of ids [id:12] filtered and sorted
isErrorboolNofalseSet error style
optionsArrayNo[]List of objects.{label : string, id : string/number, , selected : bool, disabled : bool}
isDisplayLabelboolNotrueDisplay label or not
onIsSearchingChangefunctionNo(bool)=>{}Return true/false if suggestList is open ot not
isOptionsMutableboolNofalseif true, it changes the values of the options passed in parameter
---------------
options : labelstringYes''Label of item
options : idnumber/stringNogeneratedIdUnique id of item, if not set a random id is generated
options : selectedboolNofalseset true to set default checked
options : disabledboolNofalseDisabled selection/unselection of item