
Custom Multi Select in React
Machine Coding Interview Question Build a Multi-Select Dropdown with Search (Tag Input) This is VERY frequently asked in frontend interviews. π Problem Statement Build a Multi-Select Dropdown component like this: [ React Γ ] [ JavaScript Γ ] [ + Add ] Clicking "Add" opens a dropdown with searchable options. π¦ Data const options = [ "React", "JavaScript", "TypeScript", "Node.js", "Next.js", "HTML", "CSS" ]; β Requirements 1οΈβ£ Multi Select User can select multiple options Selected items appear as tags [ React Γ ] [ CSS Γ ] 2οΈβ£ Remove Tag Each tag has β Clicking removes it 3οΈβ£ Dropdown Toggle Clicking input or button opens dropdown Clicking outside closes it 4οΈβ£ Search Filter Typing filters options: Input: "re" β React 5οΈβ£ Prevent Duplicate Selection Already selected items should: Not appear in dropdown OR Be disabled 6οΈβ£ Keyboard Support (Important) Enter β select highlighted item Backspace β remove last tag (if input empty) β οΈ Constraints (Interview Critical) β No libraries β No mutatio
Continue reading on Dev.to React
Opens in a new tab




