UI Component
Zero dependencies. Pure HTML, CSS & JavaScript.
Smooth, accessible, and production-ready.
Frequently Asked Questions
grid-template-rows from 0fr to 1fr. This is better than max-height hacks (which require a hardcoded value) and avoids any JavaScript height measurement. The browser handles all the math, and the transition is perfectly fluid at every content size.
<button> element so it gets keyboard focus and Enter/Space activation for free. The aria-expanded attribute is updated on every toggle so screen readers announce the correct state. Content panels use role="region" so they're properly sectioned.
.acc-item block and update the title, subtitle, and content inside .acc-content-text. The script uses querySelectorAll('.acc-item') so it picks up new items automatically — no JavaScript changes needed. You can also swap the SVG icon inside .acc-icon-wrap per item for extra personality.
grid-template-rows animation technique works in all modern browsers — Chrome 57+, Firefox 52+, Safari 10.1+, Edge 16+. This covers effectively 98%+ of users worldwide as of 2025. No polyfills required, no fallback needed for the animation (the content still opens, just without the transition in very old browsers).