React Multi Select Component API

Multi Select API

Rocket
New Year sale. Skyrocket your business in 2025!
Extra 25% off for all sale items + Free CoreUI Icons PRO with every order!
Limited-time offer for the first 100 customers in 2025. Use code 2025SKY25 at checkout.

Explore the API reference for the React Multi Select component and discover how to effectively utilize its props for customization.

On this page

CMultiSelect#

import { CMultiSelect } from '@coreui/react-pro'
// or
import CMultiSelect from '@coreui/react-pro/src/components/multi-select/CMultiSelect'
PropertyDefaultType
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 selectionsstring

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.

className#-string

A string of all className you want applied to the base component.

cleaner#trueboolean

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, :invalid and :valid.

id#-string

Set the id attribute for the native select element.

[Deprecated since v5.3.0] The name attribute for the native select element is generated based on the id property:

  • <select name="{id}-multi-select" />
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#trueboolean

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#autostring, 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+falseboolean

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+falseboolean

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.

The search prop determines how the search input element is enabled and behaves. It accepts multiple types to provide flexibility in configuring search behavior:

  • true : Enables the default search input element with standard behavior.
  • 'external': Enables an external search mechanism, possibly integrating with external APIs or services.
  • 'global': When set, the user can perform searches across the entire component, regardless of where their focus is within the component.
  • { external?: boolean; global?: boolean }: Allows for granular control over the search behavior by specifying individual properties. It is useful when you also want to use external and global search.
searchNoResultsLabel#No results foundReactNode

Sets the label for no results when filtering.

selectAll#trueboolean

Enables select all button.

selectAllLabel#Select all optionsReactNode

Sets the select all button label.

selectionType#tags'text', 'counter', 'tags'

Sets the selection style.

selectionTypeCounterText#item(s) selectedstring

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.

virtualScroller#4.8.0+-boolean

Enable virtual scroller for the options list.

visible#falseboolean

Toggle the visibility of multi select dropdown.

visibleItems#4.8.0+10number

Amount of visible items when virtualScroller is set to true.