This is a simple and elegant way to show and hide content on your webpage. Click the button above to collapse this section.
You can use this pattern for FAQs, product details, navigation menus, and much more!
Step 1: Click on any section header to expand it.
Step 2: Read the content that appears below.
Step 3: Click again to collapse the section.
You can have multiple sections open at the same time, or just focus on one at a time - it's up to you!
This widget uses vanilla JavaScript with CSS transitions for smooth animations. The structure includes:
example classdetails class containing the collapsible contentThe JavaScript toggles classes on both the button and content container to trigger the CSS transitions.