Multiple Select

Multiple select allows users to make a multiple selection from a dropdown list of five or more items. For fewer than five items consider using checkboxes.  

Import

Default Multiselect

Loading preview
Open in Storybook

Dismissible

Loading preview
Open in Storybook

Props

Multi Select Props

NameDescriptionDefault
label

Text that's used as the visual and accessible label for the component. If not provided, hide the component's built-in label.

string
-
aria-labelledby

The id of a label, which provides an accessible name for the component Identifies the element (or elements) that labels the current element. @see aria-describedby.

string
-
id*

ID of the trigger button element on the select

string
-
aria-describedby

ID of element providing further context and description of the select

string
-
status

If 'error', enables error styling on select

"error" | "default"
-
onOptionClick

A function that's called when an option in the select popover is clicked

((event: KeyboardEvent<HTMLLIElement> | MouseEvent<HTMLLIElement, MouseEvent>) => void)
-
selectedValues

The preselected value for the select component (controlled mode)

(string | number)[]
-
defaultSelectedValues

The default selected values for the select component (uncontrolled mode)

(string | number)[]
-
onSelectedValuesChange

A function that's called when the selected value changes. Takes the changed value and a boolean indicating if the changed value is selected as parameters (controlled mode)

((value: string | number, isSelected: boolean) => void)
-
isOpen

A boolean indicating whether the select popover is open or not (controlled mode).

boolean
-
defaultIsOpen

Determines if the menu is open by default (uncontrolled mode).

boolean
-
onIsOpenChange

A callback for when the open state is changed (controlled mode).

((isOpen: boolean) => void)
-
onTriggerKeyDown

A callback function to handle keydown events on the select button trigger element.

((event: KeyboardEvent<Element>) => void)
-
hint

Additional information for the select

string
-
children

An array of options to display in the Select, typically MultiSelectOption components

ReactElement<any, string | JSXElementConstructor<any>> | ReactElement<any, string | JSXElementConstructor<any>>[]
-
isHintVisuallyHidden

If true, visually hides the hint text (it will still be accessible to screen readers)

boolean
-
isDismissible

If true, show built-in tags for selected options

boolean
-
reactlytics
ReactlyticsProp
-
ref
((instance: HTMLButtonElement | null) => void) | RefObject<HTMLButtonElement> | null
-
disabled

@deprecated use aria-disabled instead.

The disabled prop removes the element from the Accessibility Tree and prevents it from receiving focus. This is not recommended.

All DLS components are designed to use the aria-disabled property instead, which will style the component to be disabled, but still allow keyboard focus and screen reader interactivity.

boolean
-
aria-disabled

If true, styles component as disabled and prevents interactivity. Screen reader reads as "dimmed" or "disabled".

Booleanish
-
labelOverrides

Overrides for labels that have been defaulted in the component.

MultiSelectLabelOverrides
-

Multi Select Option Props

NameDescriptionDefault
disabled

@deprecated use aria-disabled instead.

The disabled prop removes the element from the Accessibility Tree and prevents it from receiving focus. This is not recommended.

All DLS components are designed to use the aria-disabled property instead, which will style the component to be disabled, but still allow keyboard focus and screen reader interactivity.

boolean
-
aria-disabled

If true, styles component as disabled and prevents interactivity. Screen reader reads as "dimmed" or "disabled".

Booleanish
-
value*

The value of the option, which can be different from the displayed value taken from the children prop

string | number
-
id

ID of the option

string
-
aria-invalid

Flag to indicate that the field is in a warning state

Booleanish
-
aria-selected

Sets the aria-selected attribute

boolean
-
onKeyDown

A function that's called when an option in the select popover is pressed with arrow up, arrow down, or space keys

((event: KeyboardEvent<HTMLLIElement>) => void)
-
onSelectOptionClick

A function that's called when an option in the select popover is clicked

((event: MouseEvent<HTMLLIElement, MouseEvent>) => void)
-
name

The name of the button, submitted as a pair with the button's value as part of the form data, when that button is used to submit the form. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button

string
-
isMultiSelectDisabled

@ignore For DLS Internal use only. Indicates if the MultiSelect component as a whole is disabled, thereby making each option disabled

boolean
-
tagProps

Props spread onto the dismissible tags

Omit<MultiSelectTagProps, "key" | "value" | "children" | "onDismiss" | "focusedTag">
-

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.