Skip to main content

Documentation

Overview​

cn-multiselect is a fantastic web component that allows you to integrate a multiselect feature into your web page.

Usage​

Cn-multiselect-usage​

Here's a quick example of how to use cn-multiselect:

<cn-mutliselect 
title="Select your favourite fruit"
options='[{"value":"apple","label","Apple"},{"value":"banana","label","Banana"}]'>
</cn-mutliselect>

Properties​

PropertyAttributeDescriptionTypeDefault
deselectAllTextdeselect-all-text(optional) deselect all textstring'Deselect all'
disableddisabled(optional) disable multiselectbooleanfalse
disabledItemsdisabled-items(optional) disabled itemsany[] | stringundefined
maxSelectedItemsmax-selected-items(optional) max selected itemsnumber0
multiplemultiple(optional) enable multi valuesbooleantrue
namenamestringundefined
optionsoptions(optional) optionsOption[] | stringundefined
placeholderSearchplaceholder-search(optional) search's placeholderstring'Search...'
popuppopup(optional) force popup modebooleanfalse
popupBreakingPointpopup-breaking-point(optional) popup breaking point. Enable popup mode below specified window size (in px).numberundefined
popupTitlepopup-title(optional) popup titlestring'Select option'
preserveOrderpreserve-order(optional) preserve order in selected items respect the initial orderbooleanfalse
searchsearch(optional) enable searchbooleanfalse
selectAllselect-all(optional) enable select/deselect all items buttonsbooleanfalse
selectAllTextselect-all-text(optional) select all textstring'Select all'
selectedselected(optional) selected valuesany[] | stringundefined
titletitle(optional) titlestring'Select option...'

Events​

EventDescriptionType
changeValue(optional) event on change selected options. Return the option keys.CustomEvent<any[]>
clickedSelectedItem(optional) event triggered when click on selected optionCustomEvent<{ value: any; label: string; image?: string; style?: Style; data?: Data; }>
deselectedOption(optional) event on deseleted optionCustomEvent<{ value: any; label: string; image?: string; style?: Style; data?: Data; }>
selectedOption(optional) event on seleted optionCustomEvent<{ value: any; label: string; image?: string; style?: Style; data?: Data; }>

Methods​

deselectAllItems() => Promise<void>​

Deselect all items

Returns​

Type: Promise<void>

selectAllItems() => Promise<void>​

Select all items

Returns​

Type: Promise<void>

CSS Custom Properties​

NameDescription
--cn-multiselect-arrow-checkbox-color: color arrow checkbox
--cn-multiselect-background-color-selected-checkboxbackground color selected checkbox
--cn-multiselect-background-color-selected-optionbackground color selected option
--cn-multiselect-border-colorborder color
--cn-multiselect-border-color-checkboxborder color checkbox
--cn-multiselect-border-color-selected-checkboxborder color selected checkbox
--cn-multiselect-border-color-selected-optionborder color selected option
--cn-multiselect-border-radiusborder radius (es. 1px)
--cn-multiselect-border-sizeborder size (es. 1px)
--cn-multiselect-colorfont color
--cn-multiselect-color-optionfont color option
--cn-multiselect-color-placeholderfont color selected option
--cn-multiselect-color-searchfont color search text
--cn-multiselect-color-selected-optionfont color selected option
--cn-multiselect-container-backgroundcontainer background
--cn-multiselect-container-border-colorcontainer border color
--cn-multiselect-container-border-sizecontainer border size (es. 1px)
--cn-multiselect-container-selected-items-min-heightmin height container selected items
--cn-multiselect-fontfont family
--cn-multiselect-font-sizefont size
--cn-multiselect-popup-max-widthpopup max width
--cn-multiselect-popup-overlay-backgroundpopup overlay background
--cn-multiselect-popup-widthpopup width

Built with StencilJS