Multi-select components

FREE

Free and open-source React multi select components built for modern applications and websites. These multi select components are built using React Aria and styled with Tailwind CSS.

Teams*This is a hint text to help user.

Installation

You can add this multi-select component using our CLI or manually:

npx untitledui@latest add select

Multi-select examples

Below are examples and variations of this multi-select component:

Teams*This is a hint text to help user.
TeamsThis is a hint text to help user.
Teams*This is a hint text to help user.
Teams*This is a hint text to help user.
Teams*This is a hint text to help user.
AssigneesAdd one or more teammates.

The dropdown footer shows "Reset" and "Select all" buttons by default, and both work without any handlers. To change the labels or add your own actions, use the footer prop.

Pass it a function to receive React Aria's select state, so your buttons can change the selection with state.setValue() or close the dropdown with state.close(). Wrap them in MultiSelect.Footer to keep the default footer styling.

API reference

Import the parts and assemble them:

import { MultiSelect } from "@/components/base/select/multi-select";
 
<MultiSelect items={items} footer={<MultiSelect.Footer />}>
    {(item) => renderItem(item)}
</MultiSelect>

MultiSelect

Renders React Aria’s Select — all of its props are supported.

MultiSelect props
PropTypeDefaultDescription
children* (required)ReactNode | ((item: SelectItemType) => ReactNode)—The children to render for each item.
itemsSelectItemType[]—The items to display in the listbox.
selectedKeysSelection—The currently selected keys (controlled). "all" selects every enabled entry of items.
defaultSelectedKeysSelection—The initial selected keys (uncontrolled). "all" selects every enabled entry of items.
onSelectionChange((keys: Selection) => void)—Handler that is called when the selection changes.
popoverClassNamestring—Additional class name for the popover.
classNamestring—Additional class name for the root element.
onReset(() => void)—Handler that is called when the default footer's reset button is clicked. When omitted, the button clears the selection.
onSelectAll(() => void)—Handler that is called when the default footer's select all button is clicked. When omitted, the button selects every enabled item.
showFooterbooleantrueWhether to show the footer.
footerSelectFooterContent<"multiple">—Replaces the default "Reset" and "Select all" footer. Pass a function to receive the select's React Aria state, e.g. to change the selection or close the dropdown.
showSearchbooleantrueWhether to show the search input in the popover.
emptyStateTitlestring—The title to display when no items match the search.
emptyStateDescriptionstring—The description to display when no items match the search.
selectedCountFormatter((count: number) => ReactNode)—Custom formatter for the selected count text in the trigger.
supportingTextReactNode—Supporting text displayed next to the selected count in the trigger.
iconFC | ReactNode—Leading icon rendered in the trigger, before the placeholder / selected count. Matches Select's icon.
hintstring—Helper text displayed below the input.
labelstring—Field label displayed above the input.
tooltipstring—Tooltip text for the help icon next to the label.
size
"sm""md""lg"
"md"The size of the component.
placeholderstring"Select"Placeholder text when no value is selected.
hideRequiredIndicatorboolean—Whether to hide the required indicator from the label.
Props from React Aria (29)
MultiSelect inherited props
PropTypeDefaultDescription
onBlur((e: FocusEvent<Element, Element>) => void)—Handler that is called when the element loses focus.
onFocus((e: FocusEvent<Element, Element>) => void)—Handler that is called when the element receives focus.
onFocusChange((isFocused: boolean) => void)—Handler that is called when the element's focus status changes.
autoFocusboolean—Whether the element should receive focus on render.
excludeFromTabOrderboolean—Whether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available.
onKeyDown((e: KeyboardEvent) => void)—Handler that is called when a key is pressed.
onKeyUp((e: KeyboardEvent) => void)—Handler that is called when a key is released.
allowsEmptyCollectionboolean—Whether the select should be allowed to be open when the collection is empty.
autoCompletestring—Describes the type of autocomplete functionality the input should provide if any.
defaultOpenboolean—Sets the default open state of the menu.
disabledKeysIterable<Key>—The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.
formstring—The <form> element to associate the input with. The value of this attribute must be the id of a <form> in the same document.
idstring—The element's unique identifier.
isDisabledboolean—Whether the input is disabled.
isInvalidboolean—Whether the input value is invalid.
isOpenboolean—Sets the open state of the menu.
isRequiredboolean—Whether user input is required on the input before form submission.
namestring—The name of the input, used when submitting an HTML form.
onOpenChange((isOpen: boolean) => void)—Method that is called when the open state of the menu changes.
shouldCloseOnSelectboolean—Whether the Select should close when an item is selected. Defaults to true if selectionMode is single, false otherwise.
validate((value: Key[]) => ValidationError | true | null | undefined)—A function that returns an error message if a given value is invalid. Validation errors are displayed to the user when the form is submitted if validationBehavior="native". For realtime validation, use the isInvalid prop instead.
validationBehavior
"native""aria"
"native"Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.
styleStyleOrFunction<SelectRenderProps>—The inline style for the element. A function may be provided to compute the style based on component state.
slotstring | null—A slot name for the component. Slots allow the component to receive props from a parent component. An explicit null value indicates that the local props completely override all props received from a parent.
renderDOMRenderFunction<"div", SelectRenderProps>—Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components.Requirements:
  • You must render the expected element type (e.g. if <button> is expected, you cannot render an <a>).
  • Only a single root DOM element can be rendered (no fragments).
  • You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
aria-describedbystring—Identifies the element (or elements) that describes the object.
aria-detailsstring—Identifies the element (or elements) that provide a detailed, extended description for the object.
aria-labelstring—Defines a string value that labels the current element.
aria-labelledbystring—Identifies the element (or elements) that labels the current element.

Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.

MultiSelect.EmptyState

Renders a <div> element.

MultiSelect.EmptyState props
PropTypeDefaultDescription
titlestring"No results found"The title to display.
descriptionstring"Please try a different search term."The description to display.
onClearSearch(() => void)—Handler that is called when the clear search button is clicked.
classNamestring—Additional class name.

MultiSelect.Item

Import SelectItem from @/components/base/select/select-item. Renders React Aria’s ListBoxItem — all of its props are supported.

MultiSelect.Item props
PropTypeDefaultDescription
id* (required)string | number—Unique identifier for the item.
selectionIndicator
"checkmark""checkbox""none"
"checkmark"The selection indicator to be displayed on the item.
selectionIndicatorAlign
"left""right"
"right"The alignment of the selection indicator.
labelstring—The primary display text.
avatarUrlstring—Avatar image URL.
supportingTextstring—Secondary text displayed alongside the label.
iconFC | ReactNode—Leading icon component or element.
Props from React Aria (31)
MultiSelect.Item inherited props
PropTypeDefaultDescription
onClick((e: MouseEvent<FocusableElement>) => void)—Not recommended – use onPress instead. onClick is an alias for onPress provided for compatibility with other libraries. onPress provides additional event details for non-mouse interactions.
onPress((e: PressEvent) => void)—Handler that is called when the press is released over the target.
onPressChange((isPressed: boolean) => void)—Handler that is called when the press state changes.
onPressEnd((e: PressEvent) => void)—Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
onPressStart((e: PressEvent) => void)—Handler that is called when a press interaction starts.
onPressUp((e: PressEvent) => void)—Handler that is called when a press is released over the target, regardless of whether it started on the target or not.
onHoverChange((isHovering: boolean) => void)—Handler that is called when the hover state changes.
onHoverEnd((e: HoverEvent) => void)—Handler that is called when a hover interaction ends.
onHoverStart((e: HoverEvent) => void)—Handler that is called when a hover interaction starts.
onBlur((e: FocusEvent<HTMLDivElement, Element>) => void)—Handler that is called when the element loses focus.
onFocus((e: FocusEvent<HTMLDivElement, Element>) => void)—Handler that is called when the element receives focus.
onFocusChange((isFocused: boolean) => void)—Handler that is called when the element's focus status changes.
onKeyDown((e: KeyboardEvent) => void)—Handler that is called when a key is pressed.
onKeyUp((e: KeyboardEvent) => void)—Handler that is called when a key is released.
downloadstring | boolean—Causes the browser to download the linked URL. A string may be provided to suggest a file name.
hrefstring—A URL to link to.
hrefLangstring—Hints at the human language of the linked URL.
pingstring—A space-separated list of URLs to ping when the link is followed.
referrerPolicy
"""no-referrer""no-referrer-when-downgrade""origin""origin-when-cross-origin""same-origin""strict-origin""strict-origin-when-cross-origin""unsafe-url"
—How much of the referrer to send when following the link.
relstring—The relationship between the linked resource and the current page.
routerOptionsRouterOptions—Options for the configured client side router.
targetHTMLAttributeAnchorTarget—The target window for the link.
isDisabledboolean—Whether the item is disabled.
onAction(() => void)—Handler that is called when a user performs an action on the item. The exact user event depends on the collection's selectionBehavior prop and the interaction modality.
textValuestring—A string representation of the item's contents, used for features like typeahead.
valueSelectItemType—The object value that this item represents. When using dynamic collections, this is set automatically.
styleStyleOrFunction<ListBoxItemRenderProps>—The inline style for the element. A function may be provided to compute the style based on component state.
childrenChildrenOrFunction<ListBoxItemRenderProps>—The children of the component. A function may be provided to alter the children based on component state.
classNameClassNameOrFunction<ListBoxItemRenderProps>—The CSS className for the element. A function may be provided to compute the class based on component state.
render(props: DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement> | JSX.IntrinsicElements[Fallback], renderProps: T) => ReactElement—Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components.Note: You can check if 'href' in props in order to tell whether to render an <a> element.Requirements:
  • You must render the expected element type (e.g. if <a> is expected, you cannot render a <button>).
  • Only a single root DOM element can be rendered (no fragments).
  • You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
aria-labelstring—An accessibility label for this item.

Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.

FAQs

Please refer to our frequently asked questions page for more.

The multi-select supports "sm", "md" and "lg" through the size prop. The default is "md", and the size also scales the search field and footer buttons inside the popover.

Set isDisabled to true. The trigger drops to 50% opacity and can no longer open the popover.

Pass selectedKeys and onSelectionChange for a controlled multi-select, or defaultSelectedKeys to let it manage the selection itself. Both take a React Aria Selection: a Set of item ids, or "all" for every enabled entry in items.

The dropdown footer renders by default (showFooter defaults to true) with a "Reset" and a "Select all" button. They clear the selection and select every enabled item on their own. Pass onReset or onSelectAll to replace that behavior, or set showFooter={false} to remove the footer.

Pass a function to footer, as in the Custom footer example. It receives React Aria's SelectState: call state.setValue() with an array of item ids to change the selection, and state.close() to close the dropdown. To select every item, pass all their ids to state.setValue(), because React Aria's selectionManager.selectAll() has no effect inside a select.

With nothing selected the trigger shows placeholder, which defaults to "Select". Once items are selected it shows "{count} selected"; pass selectedCountFormatter, which receives the count and returns a ReactNode, to change that, and supportingText to add muted text after it, such as "12 users".

Set showSearch={false} to remove the search input from the popover. Use emptyStateTitle and emptyStateDescription to customize the empty state shown when the listbox has no items (no search results, or an empty items array).