Multi Selector

A multiple selector component built with shadcn/ui. Supports searching, tagging, and multi-value selection with an accessible and customizable design for modern React apps.

Thanks to Sersavan

Selected Frameworks:

  • nextjs
  • svelte

Installation

npx uilayouts@latest add multi-selector

Props

PropTypeDefaultDescription
options{ label: string; value: string; icon?: React.ComponentType; disable?: boolean; }[][]An array of option objects displayed in the multi-select. Each object has a label, value, optional icon, and optional disable flag.
onValueChange(value: string[]) => voidundefinedCallback triggered when the selected values change. Receives an array of selected values.
defaultValuestring[][]The default selected values when the component mounts.
placeholderstring"Select options"Text displayed when no values are selected.
animationnumber0Duration of animation effects (in seconds) for visual feedback like bouncing badges.
maxCountnumber3Maximum number of items to display before summarizing the rest.
modalPopoverbooleanfalseEnables modal behavior for the popover, disabling interaction with outside elements and enhancing accessibility for screen readers.
asChildbooleanfalseRenders the multi-select as a child element of another component.
classNamestringundefinedAdditional CSS classes for custom styling of the multi-select component.
popoverClassstringundefinedAdditional CSS classes for custom styling of the popover content.
showallbooleanfalseOption to display all items without truncating the list, regardless of the maxCount setting.
refReact.RefObject<HTMLButtonElement>undefinedA React ref object for the root element of the multi-select component, allowing for external access to the component’s DOM node.