Expand/Collapse Widgets

Getting Started

Welcome to our expand/collapse widget! This is a simple yet powerful UI component that helps you organize content efficiently.

Click the header to expand or collapse the content below. You can use multiple widgets to create an accordion-like effect.

Features

  • Smooth expand/collapse animation
  • Responsive design that works on all devices
  • Easy to customize with CSS
  • Lightweight JavaScript implementation
  • Accessible and user-friendly
  • Works with any content type

FAQ

Q: Can I customize the animation speed?

A: Yes! Modify the transition duration in the CSS to adjust the animation speed.

Q: Does it support multiple expanded items?

A: Absolutely! You can expand multiple widgets simultaneously.

Q: Is it mobile-friendly?

A: Yes, the widget is fully responsive and works great on mobile devices.

Implementation

The widget uses a simple toggle function to add/remove the 'expanded' class. When expanded, the max-height CSS property is set to allow the content to display with a smooth transition.

Each widget consists of:

  • .example - The outer wrapper
  • .widget-header - The clickable header
  • .toggle-icon - The expand/collapse arrow
  • .details - The collapsible content container