Skip to content
GitHub ↗

Content / React + CSS

Expandable panel

A compact project summary expands smoothly into useful detail.

Live preview
Review the direction, align the details, and prepare the next iteration for your team.Ready for review

Make it yours

Use for a compact summary that has optional details. Keep the summary sufficient to identify the item. The panel manages its own open state.

  1. Use a React project with CSS Modules support, such as Next.js or Vite.
  2. Save the JSX as ExpandablePanel.jsx and the CSS as ExpandablePanel.module.css in the same folder.
  3. Import ExpandablePanel 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
titlestringSummary heading.
summarystringShort supporting text.
childrenReactNodeExpanded content.

Accessibility & behavior

The trigger exposes aria-expanded and aria-controls. The closed content is inert so nested controls cannot receive focus. The reveal uses a reduced-motion-aware grid transition.

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