Premium

Angular Accordion / FAQ Component

By FrontendAtlas Team · Updated Jan 30, 2026

Build a simple FAQ (accordion) component in Angular using inputs/outputs. Clicking a question should toggle its answer. By default, only one item can be open at a time, but the user can enable a mode where multiple items can stay open. Concepts: components, inputs, outputs.…

  • Use a standalone root component and at least one child component for…
  • Render a list of 3–4 FAQ items (question + answer) from an…

What you’ll build / What this tests

This premium angular coding focuses on Angular Accordion / FAQ Component. You’ll apply components and inputs thinking with intermediate level constraints. The prompt emphasizes Build a simple FAQ (accordion) component in Angular using inputs/outputs. Clicking a question should toggle its….

Learning goals

  • Translate the prompt into a clear angular API signature and return shape.
  • Apply components, inputs, outputs techniques to implement angular accordion / faq component.
  • Handle intermediate edge cases without sacrificing readability.
  • Reason about time/space complexity and trade-offs in angular.

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

  • Use a standalone root component and at least one child component for a single FAQ item.
  • Render a list of 3–4 FAQ items (question + answer) from an in-memory array.
  • Clicking on a question toggles its answer open/closed.
  • In the default mode, only one FAQ item can be open at a time.
  • Add a simple control (e.g. a toggle or checkbox) to switch to 'allow multiple open' mode.
  • In 'allow multiple open' mode, the user should be able to open more than one FAQ item at…
  • Initially all FAQ items are closed.
  • Clicking a closed question opens its answer.
  • In single-open mode: opening one item automatically closes any other open item.
  • Switching to multi-open mode keeps already open items and allows opening others.

Mini snippet (usage only)

// Example usage
const input = /* angular accordion / faq component 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.