Basic Usage
Item Structure
Each item is a dictionary with:The clickable header text or component
The collapsible content
Unique identifier (defaults to “item-”)
Disables this specific item
With Components
Controlled State
Currently expanded items (controlled)
Initially expanded items (uncontrolled)
Event fired when expanded items change
Multiple vs Single
Allow multiple items to be open simultaneously
Other Props
Disables all accordion items
Visual orientation for keyboard navigation
Whether arrow keys loop to first item at end
Keep closed panels in DOM for animations
Compositional API
For full control, compose manually:Accordion Components
accordion.root
Container for all accordion items.accordion.item
Groups a trigger with its panel.accordion.header
Wrapper for the trigger (for semantic HTML).accordion.trigger
Clickable button to toggle the panel.accordion.panel
Collapsible content area.Styling Classes
Access predefined styles viaui.accordion.class_names:
ROOT: Container with borders and shadowsITEM: Individual item (empty by default)HEADER: Header wrapperTRIGGER: Clickable trigger button with hover statesPANEL: Content panel with height animationPANEL_DIV: Inner padding wrapperTRIGGER_ICON: Animated icon (rotates when open)
Custom Icons
The default trigger icon rotates 45° when open (creating an X from a +). Customize by using the compositional API:Dynamic Items
Use reactive lists:Implementation Details
From source code atreflex_ui/components/base/accordion.py:169:
- Built on Base UI Accordion primitives
- High-level API auto-generates structure from items list
- Supports both static lists and reactive Var lists
- Height animation via CSS transitions on
--accordion-panel-height - Plus icon rotates and scales when item opens
- Border dividers between items