Accordion

A vertically stacked set of interactive headings that each reveal a section of content.

Default

Single mode — one item open at a time.

Yes. It adheres to the WAI-ARIA design pattern.

Yes. It comes with default styles that match the Suite.jl design system.

Yes. It uses CSS transitions for smooth expand/collapse.

Multiple

Multiple items can be open simultaneously.

Content for the first section.

Content for the second section.

Collapsible

Single mode with collapsible — all items can be closed.

Click the trigger again to collapse.

Both items can be closed simultaneously.

Usage

julia
using Suite

Accordion(default_value="item-1",
    AccordionItem(value="item-1",
        AccordionTrigger("Section 1"),
        AccordionContent(P("Content 1")),
    ),
    AccordionItem(value="item-2",
        AccordionTrigger("Section 2"),
        AccordionContent(P("Content 2")),
    ),
)

Keyboard Interactions

KeyAction
Enter / SpaceToggle the focused accordion item
Arrow DownMove focus to the next trigger
Arrow UpMove focus to the previous trigger
HomeMove focus to the first trigger
EndMove focus to the last trigger

API Reference

Accordion

PropTypeDefaultDescription
typeString"single""single" or "multiple" — selection mode
collapsibleBoolfalseAllow all items to be closed (single mode)
default_valueString/VectornothingInitially open item(s)
orientationString"vertical""vertical" or "horizontal"
disabledBoolfalseDisable all items
classString""Additional CSS classes

AccordionItem

PropTypeDefaultDescription
valueString""Unique identifier for this item (required)
disabledBoolfalseDisable this specific item
classString""Additional CSS classes

AccordionTrigger

PropTypeDefaultDescription
children...Any-Trigger content (text)
classString""Additional CSS classes

AccordionContent

PropTypeDefaultDescription
children...Any-Panel content
classString""Additional CSS classes