Expand/Collapse Widget Demo

What is this widget?

This is an expand/collapse widget built with HTML, CSS, and JavaScript. Click the header to toggle the visibility of this content. The widget uses smooth transitions and icons to indicate its state.

Features

  • Smooth expand/collapse animation
  • Rotating indicator icon
  • Hover effects on header
  • Responsive design
  • Pure CSS and JavaScript solution

Getting Started

This widget is initially expanded. Click the header to collapse it. Each widget can be independently controlled by clicking its header. The state is managed through the 'expanded' class on the widget container, which triggers CSS transitions for smooth animations.

Implementation Details

The widget uses a simple JavaScript function that toggles the 'expanded' class on the widget element. The CSS handles the visual transitions using max-height with overflow hidden. This approach provides smooth animations without requiring complex JavaScript libraries or frameworks.