React Multi Select Component API
Multi Select API
Explore the API reference for the React Multi Select component and discover how to effectively utilize its props for customization.
CMultiSelect#
import { CMultiSelect } from '@coreui/react-pro'// orimport CMultiSelect from '@coreui/react-pro/src/components/multi-select/CMultiSelect'| Property | Default | Type |
|---|---|---|
| allowCreateOptions#4.11.0+ | - | boolean |
Allow users to create options if they are not in the list of options. | ||
| ariaCleanerLabel#5.8.0+ | Clear all selections | string |
A string that provides an accessible label for the cleaner button. This label is read by screen readers to describe the action associated with the button. | ||
| ariaIndicatorLabel#5.19.0+ | Toggle visibility of options menu | string |
A string that provides an accessible label for the indicator button. This label is read by screen readers to describe the action associated with the button. | ||
| className# | - | string |
A string of all className you want applied to the base component. | ||
| cleaner# | true | boolean |
Enables selection cleaner element. | ||
| clearSearchOnSelect#4.11.0+ | - | boolean |
Clear current search on selecting an item. | ||
| container#5.8.0+ | - | Element, DocumentFragment, (() => Element | DocumentFragment) |
Appends the dropdown to a specific element. You can pass an HTML element or function that returns a single element. | ||
| disabled# | - | boolean |
Toggle the disabled state for the component. | ||
| feedback#4.2.0+ | - | ReactNode |
Provide valuable, actionable feedback. | ||
| feedbackInvalid#4.2.0+ | - | ReactNode |
Provide valuable, actionable feedback. | ||
| feedbackValid#4.2.0+ | - | ReactNode |
Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, | ||
| id# | - | string |
Set the id attribute for the native select element.
| ||
| invalid# | - | boolean |
Set component validation state to invalid. | ||
| label#4.2.0+ | - | ReactNode |
Add a caption for a component. | ||
| loading#4.11.0+ | - | boolean |
When set, the options list will have a loading style: loading spinner and reduced opacity. | ||
| multiple# | true | boolean |
It specifies that multiple options can be selected at once. | ||
| name#5.3.0+ | - | string |
The name attribute for the select element. | ||
| onChange# | - | (selected: Option[]) => void |
Execute a function when a user changes the selected option. | ||
| onFilterChange#4.8.0+ | - | (value: string) => void |
Execute a function when the filter value changed. | ||
| onHide# | - | () => void |
The callback is fired when the Multi Select component requests to be hidden. | ||
| onShow# | - | () => void |
The callback is fired when the Multi Select component requests to be shown. | ||
| options# | - | (Option | OptionsGroup)[] |
List of option elements. | ||
| optionsGroupsTemplate#4.12.0+ | - | (option: OptionsGroup) => ReactNode |
Custom template for options groups. | ||
| optionsMaxHeight# | auto | string, number |
Sets maxHeight of options list. | ||
| optionsStyle# | checkbox | 'text', 'checkbox' |
Sets option style. | ||
| optionsTemplate#4.12.0+ | - | (option: Option) => ReactNode |
Custom template for options. | ||
| placeholder# | Select... | string |
Specifies a short hint that is visible in the search input. | ||
| portal#5.8.0+ | false | boolean |
Generates dropdown menu using createPortal. | ||
| required# | - | boolean |
When it is present, it indicates that the user must choose a value before submitting the form. | ||
| resetSelectionOnOptionsChange#5.3.0+ | false | boolean |
Determines whether the selected options should be cleared when the options list is updated. When set to true, any previously selected options will be reset whenever the options list undergoes a change. This ensures that outdated selections are not retained when new options are provided. | ||
| search# | true | Search |
The
| ||
| searchNoResultsLabel# | No results found | ReactNode |
Sets the label for no results when filtering. | ||
| selectAll# | true | boolean |
Enables select all button. | ||
| selectAllLabel# | Select all options | ReactNode |
Sets the select all button label. | ||
| selectionType# | tags | 'text', 'counter', 'tags' |
Sets the selection style. | ||
| selectionTypeCounterText# | item(s) selected | string |
Sets the counter selection label. | ||
| size# | - | 'sm', 'lg' |
Size the component small or large. | ||
| text#4.2.0+ | - | ReactNode |
Add helper text to the component. | ||
| tooltipFeedback#4.2.0+ | - | boolean |
Display validation feedback in a styled tooltip. | ||
| valid# | - | boolean |
Set component validation state to valid. | ||
| value#5.13.0+ | - | string, number, (string | number)[] |
Sets the initially selected values for the multi-select component. | ||
| virtualScroller#4.8.0+ | - | boolean |
Enable virtual scroller for the options list. | ||
| visible# | false | boolean |
Toggle the visibility of multi select dropdown. | ||
| visibleItems#4.8.0+ | 10 | number |
Amount of visible items when virtualScroller is set to | ||