0.0.4 • Published 3 years ago
fbro-multiselect v0.0.4
fbro-multiselect
This library was generated with Angular CLI version 9.0.7.
Installation
npm i fbro-multiselect
Usage
import {MultiselectModule} from "fbro-multiselect";
@NgModule({
...
imports: [BrowserModule, MultiselectModule]
...
})
class MainModule { }
<multiselect
[options]="options"
[filter]="true"
filterBy="label"
optionLabel="label"
optionValue="value"
(onChange)="selectedValues($event)"></multiselect>
</select2>
properties and events
name | type | default | description | example |
---|---|---|---|---|
options | {}[] array of objects | [] | Options on the dropdown | options: {}[] = [{label:'option1', value:'one'}, ...] |
filter | boolean | false | Enable search options | [filter]="true" |
filterBy | string | label | Object properties for search. add more properties seperated by comma (,) | filterBy="label,value,customProp" |
optionLabel | string | label | text to show at dropdown option | optionLabel="customProp" |
optionValue | string | value | value of the given label | optionValue="customPropVal" |
onChange | method | emmit event on change when add/remove value | (onChange)="printTheChange($event)" |
Features
- close dropdown on press Escape(
Esc
) key - close dropdown on outclick
- move/highlight option by using up and down keys
- press space key to select/deselect the highlighted option