Diwa Design System

Accordion

An animated, accessible panel that reveals or hides content when the user clicks its heading. Follows the controlled component pattern — the consumer manages open state.

Properties

NameTypeDefaultDescription
headingstring''Visible heading text rendered inside the toggle button.
headingTag'h2' | 'h3' | 'h4' | 'h5' | 'h6''h2'Semantic heading element that wraps the toggle button. Set to match the page heading hierarchy.
openbooleanfalseWhether the panel is expanded. Controlled prop — the consumer must update it in response to the update event.
compactbooleanfalseEnables dense mode. Reduces header padding and font size for denser layouts.
theme'dark' | 'light''dark'Per-component theme override. Sets data-theme on the host so token overrides cascade into the shadow DOM.

Events

NameDetail typeBubblesDescription
update{ open: boolean }NoEmitted when the user clicks the toggle button. detail.open is the requested new state. The consumer must set the open prop to this value. Not bubbles, not composed.

When using in React (JSX), listen via onupdate (lowercase) because React 19 maps onXxxaddEventListener('Xxx', ...) without lowercasing.

Slots

SlotDescription
defaultCollapsible panel content. Any HTML or components can be slotted here. Interactive children (links, buttons, inputs) are automatically removed from the tab order when the panel is closed via visibility: hidden.

CSS Custom Properties

PropertyDescription
--diwa-transition-slowControls the duration of the panel expand/collapse animation and the chevron rotation. Defaults to 0.25s ease.
--diwa-borderColor of the bottom divider line rendered below each accordion item.
--diwa-bg-hoverBackground of the header 'pill' hover state.
--diwa-bg-activeBackground of the header pill on mouse-down.
--diwa-text-primaryHeading text color.