Multi Select Dropdown

Forms
Selection

Select multiple options with color-coded tags and checkbox controls.

Preview

Select multiple options with color-coded tags

DesignFrontend

Props

Component API reference

MultiSelectDropdown

PropTypeDefaultDescription
optionsSelectOption[]defaultOptionsAvailable options to select from
defaultValuestring[]['design', 'frontend']Default selected option IDs (uncontrolled)
valuestring[]Controlled selected values
onValueChange(selected: string[]) => voidCallback when selection changes
onApply(selected: string[]) => voidCallback when apply button is clicked
showApplyButtonbooleantrueShow apply button in footer
showClearButtonbooleantrueShow clear all button in footer
classNamestringAdditional CSS classes

SelectOption Type

{ id: string label: string color?: string // Tailwind classes for background and text color }

Usage

Import and implementation examples

import { MultiSelectDropdown } from '@/components/ui/multi-select-dropdown'
import { useState } from 'react'

// Basic usage (uncontrolled)
<MultiSelectDropdown />

// Controlled component
const [selected, setSelected] = useState(['design', 'frontend'])

<MultiSelectDropdown
  value={selected}
  onValueChange={(newSelected) => {
    setSelected(newSelected)
    console.log('Selected:', newSelected)
  }}
  onApply={(selectedIds) => {
    console.log('Applied:', selectedIds)
  }}
/>

// Custom options
const customOptions = [
  {
    id: 'javascript',
    label: 'JavaScript',
    color: 'bg-yellow-100 text-yellow-700'
  },
  {
    id: 'typescript',
    label: 'TypeScript',
    color: 'bg-blue-100 text-blue-700'
  },
  {
    id: 'python',
    label: 'Python',
    color: 'bg-green-100 text-green-700'
  },
]

<MultiSelectDropdown
  options={customOptions}
  defaultValue={['javascript']}
  showApplyButton={true}
  showClearButton={true}
/>

Features

Built-in functionality

  • Color-coded tags: Visual display for selected items
  • Checkbox controls: Easy toggle for each option
  • Clear all button: Reset selection quickly
  • Apply button: Confirm changes explicitly
  • 6 color categories: Design, Frontend, Backend, DevOps, Mobile, Data
  • Bulk selection: Select/deselect with visual feedback
  • Controlled & uncontrolled: Both modes supported
  • Customizable options: Custom options and colors
  • Dark mode: Full dark mode support

Accessibility

Accessibility considerations

ARIA Attributes

Uses button with aria-haspopup="listbox"aria-expanded for dropdown stateCheckboxes have proper labelsSelected items announced by screen readers

Keyboard Navigation

KeyAction
Enter/SpaceOpen dropdown / Toggle checkbox
EscapeClose dropdown
TabNavigate between checkboxes
Arrow KeysNavigate options (when focused)

Notes

  • Focus trapped within open dropdown
  • Clear and Apply buttons are focusable
  • Selection count announced when changed