Skip to content
GitHub ↗

Content / React + CSS

Accordion

Give supporting details room to breathe without overwhelming the page.

Live preview
Designed to be yours.
Copy the component, adjust the tokens, and make it fit your product.
What do I need?
React and CSS Modules. No animation library or icon package required.
Can I use my keyboard?
Yes. Tab to a heading and press Enter or Space to open it.

Make it yours

Use for supporting explanations and FAQs. Keep essential instructions visible outside the accordion. Multiple items can stay open.

  1. Use a React project with CSS Modules support, such as Next.js or Vite.
  2. Save the JSX as Disclosure.jsx and the CSS as Disclosure.module.css in the same folder.
  3. Import Disclosure and connect its props to your application. Controlled components need parent state and change handlers.

No third-party component or animation package is required. Use the theme controls to adjust accent, corners, spacing, and type. Copy the Theme CSS into your stylesheet and wrap your components in <div className="tdp-components">. The theme applies to every component inside that wrapper. TDP defaults work without a theme file.

Props

PropTypeUse
itemsarrayObjects with unique title and content properties.

Accessibility & behavior

Native details and summary expose expanded state and keyboard activation. Hidden content is removed from keyboard navigation until opened.

Visible focus styles and reduced-motion support are included. Check labels, contrast, keyboard behavior, and screen-reader output again after adapting the component to your product.

Keep building