Accordion

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

Is it accessible?

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

Is it styled?

Yes. It comes with default styles that match the other components' aesthetic.

Is it animated?

Yes. It's animated by default.

Custom Icons

Triggers may use custom icons.

Custom icons

You can use your own custom icons.

Turn that frown upside down

Custom icons make me happy.

Anatomy

Import all parts and piece them together.

use leptos::prelude::*;
use singlestage::accordion::*;

#[component]
pub fn AccordionAnatomy() -> impl IntoView {
    view! {
        <Accordion>
            <AccordionItem>
                <AccordionTrigger
                    <AccordionIcon />
                <AccordionTrigger/>
                <AccordionContent />
            </AccordionItem>
        </Accordion>
    }
}

API Reference

Accordion

Contains all the parts of an accordion.

Implements global attributes.

AccordionContent

Contains all the collapsible content for an item. Implements HTML global attributes.

Implements global attributes.

AccordionIcon

Optional. Used to wrap content such as an icon to replace the default trigger icon.

Note: the slot attribute is required.

AccordionItem

Contains all the parts of a collapsible section. If all items have the same name then only one can be open at a time.

Implements global and details attributes.

AccordionTrigger

Toggles the collapsed state of its associated item. Also serves as the header. Implements HTML global attributes.

Implements global attributes.