FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Easy

Accordion

15 mins

Build an Accordion component that displays a list of collapsible sections, each with a title and content.

Requirements:

  1. All sections are collapsed by default.
  2. Clicking a section title toggles its content.
  3. Expanded sections display their content.
  4. Collapsed sections hide their content.
  5. Each section operates independently of the others.

Notes:

  • Focus on functionality over styling.
  • You may modify the markup if needed (ids, data attributes, etc).
  • Bonus: Think about accessibility and better user experience.

Code Editor

React Component

00:00
Loading...

Live Preview

See your React component