This is a simple multi-select component for Salesforce Lightning.
- Clone or download this repository
- Copy the
multiSelect
component directory into your project'slwc
directory - Deploy the component
- You can now use the
<c-multi-select>
component
get colorOptions() {
return [
{
value: 'black',
label: 'Black',
},
{
value: 'red',
label: 'Red',
}
]
}
get defaultColors() {
return [
'black'
];
}
onSelectColors(event) {
const { options } = event.detail;
console.log('Selected colors', options);
}
<c-multi-select
options="{colorOptions}"
value="{defaultColors}"
onselected="{onSelectColors}"
>
</c-multi-select>