FAQ DisclosureLoading saved progress…

FAQ Disclosure

A disclosure reveals or hides supporting content when you activate its trigger. Build a React FAQ list where each question controls its own answer, so several answers may stay open at once. The starter renders the complete collapsed layout; you add the state and event wiring.

Signature

Implement the default App component in App.tsx. Keep a Set<number> of open row indices and toggle one index from each question button.

Examples

  • Initially, all three buttons have aria-expanded={false} and no answer regions render.
  • Clicking Can I cancel anytime? opens only its answer, rotates its chevron, and changes that button to aria-expanded={true}.
  • Clicking Do you offer refunds? keeps the first answer open while revealing the second. Clicking the first question again closes only the first.

Notes

  • Independent rows: this is multi-open disclosure behavior, not a single-open accordion.
  • One source of truth: derive the class, ARIA value, and conditional answer from open.has(i).
  • Immutable update: return a copied Set from the React state updater so React sees a new reference.
  • Accessible control: keep aria-expanded on the button and preserve its aria-controls link to the answer region.
  • Scope: styling and the fixed three-question data set are provided.
WE’RE LISTENING

Help make UIReady better

Found a bug or have an idea? Tell us about it.

Up to 3 files · 5 MiB each · JPG, PNG, WebP, MP4, WebM, MP3, M4A or WAV