Premium
Invite Chips Input (Tags + Autocomplete)
Build a Material-like invite field in React. As users type, show autocomplete suggestions, convert selections into removable chips, and support keyboard shortcuts (Enter/comma/backspace).
- Render an input that creates chips below/inside the field.
- Show autocomplete suggestions filtered from a fixed users list.
What you’ll build / What this tests
This premium react coding focuses on Invite Chips Input (Tags + Autocomplete). You’ll apply react and state thinking with medium level constraints. The prompt emphasizes Build a Material-like invite field in React. As users type, show autocomplete suggestions, convert selections into….
Learning goals
- Translate the prompt into a clear react API signature and return shape.
- Apply react, state, event-handlers techniques to implement invite chips input (tags + autocomplete).
- Handle medium edge cases without sacrificing readability.
- Reason about time/space complexity and trade-offs in react.
Key decisions to discuss
- Define the exact input/output contract before coding.
- Prioritize predictable edge-case handling over micro-optimizations.
Evaluation rubric
- Correctness: covers required behaviors and edge cases.
- Clarity: readable structure and predictable control flow.
- Complexity: avoids unnecessary work for large inputs.
- API discipline: no mutation of inputs; returns expected shape.
- Testability: solution is easy to unit test.
Constraints / Requirements
- Render an input that creates chips below/inside the field.
- Show autocomplete suggestions filtered from a fixed users list.
- Exclude already-selected users from suggestions.
- Clicking a suggestion creates a chip and clears the input.
- Pressing Enter or comma creates/selects a chip.
- Backspace on empty input removes the last chip.
- Each chip has a remove button that updates state correctly.
- Support ArrowUp/ArrowDown + Enter keyboard navigation in the suggestion list.
- Typing "al" surfaces matching user suggestions (name or email).
- Selecting "Alice" adds one chip and it no longer appears in suggestions.
Mini snippet (usage only)
// Example usage
const input = /* invite chips input (tags + autocomplete) input */;
const result = solve(input);
console.log(result);
// Edge case check
const empty = input ?? null;
const fallback = solve(input);
console.log(fallback);
// Expected: describe output shape, not the implementation
// (no solution code in preview)Common pitfalls
- Mutating inputs instead of returning a new value.
- Skipping edge cases like empty input, duplicates, or nulls.
- Overlooking time complexity for large inputs.
Related questions
Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.