Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
Installation
Command to install the Accordion component.
Component Guide
Use the following to build the Accordion component.
from components.ui.accordion import accordionSource Code & Dependencies
For manual installation, copy each of the source codes below in their respective locations.
components/core/core.py
components/core/hugeicon.py
components/ui/accordion.py
Examples
Basic
Built on native <details>/<summary> — expand/collapse, keyboard support, and the chevron rotation all come from the browser and group-open/accordion-item:rotate-180, no JS required.
Props used: name on accordion.item (groups items so only one stays open at a time, matching native <details name="..."> behavior).
Models
- Genesis launched a new era of exploration.
- Explorer uncovered new planets beyond our reach.
- Voyager 1 ventured into interstellar space.
- Apollo landed humans on the Moon.
Spacecraft
- Curiosity sent back valuable data from Mars.
- The Hubble Telescope captured distant galaxies.
- James Webb will explore the universe's origins.
- The ISS orbits Earth, conducting critical experiments.
Space Discoveries
- Saturn's rings have fascinated scientists for years.
- The Mars Rover is studying the planet's surface.
- NASA's Artemis program aims to return humans to the Moon.
- Solar missions help us understand space weather.
API Reference
accordion.root
accordion.root(
accordion.item(...),
accordion.item(...),
)
accordion.item
Renders a native <details>. Give matching items the same name to make them mutually exclusive (native <details name="..."> grouping — opening one closes the others in the group automatically).
accordion.item(
accordion.trigger("Is it accessible?"),
accordion.panel("Yes, built on native semantics."),
name="faq",
)
accordion.trigger
Renders a <summary> with a chevron icon appended automatically — no need to add one yourself.
accordion.trigger("Is it accessible?")
accordion.panel
accordion.panel("Yes. It adheres to the WAI-ARIA design pattern.")