Accordion

Divide content into collapsible sections

<sa-accordion>
    <sa-accordion-item>
        <sa-accordion-item-title>
            What payment methods do you accept?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            We accept all major credit and debit cards (Visa, Mastercard, Amex) and popular digital wallets like Apple
            Pay and Google Pay for your convenience.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item>
        <sa-accordion-item-title>
            When will I receive my booking confirmation?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Your confirmation and e-tickets are usually emailed within minutes. If not, please check your spam folder or
            view the details in your account's "My Trips" section.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item>
        <sa-accordion-item-title>
            Can I earn loyalty points or frequent flyer miles?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Yes, you can enter your frequent flyer number during flight booking. For hotels and packages, eligibility
            depends on the specific service provider's loyalty program rules.
        </sa-accordion-item-content>
    </sa-accordion-item>
</sa-accordion>

Usage

Use <sa-accordion> to wrap a collection of accordion items. Individual items are created using the <sa-accordion-item> element containing <sa-accordion-item-title> and <sa-accordion-item-content> which contains the title and content respectively.

<sa-accordion>
    <sa-accordion-item>
        <sa-accordion-item-title>
            ...
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            ...
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item>
        ...
    </sa-accordion-item>
</sa-accordion>

Examples

Single open item

The name attribute of <sa-accordion-item> allows you to link multiple accordion items to a single group. When they are connected in this manner, only a single item can be opened at a time.

This behavior is managed by the <details> HTML element, which <sa-accordion-item> uses.

<sa-accordion>
    <sa-accordion-item name="faq">
        <sa-accordion-item-title>
            What payment methods do you accept?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            We accept all major credit and debit cards (Visa, Mastercard, Amex) and popular digital wallets like Apple
            Pay and Google Pay for your convenience.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item name="faq">
        <sa-accordion-item-title>
            When will I receive my booking confirmation?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Your confirmation and e-tickets are usually emailed within minutes. If not, please check your spam folder or
            view the details in your account's "My Trips" section.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item name="faq">
        <sa-accordion-item-title>
            Can I earn loyalty points or frequent flyer miles?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Yes, you can enter your frequent flyer number during flight booking. For hotels and packages, eligibility
            depends on the specific service provider's loyalty program rules.
        </sa-accordion-item-content>
    </sa-accordion-item>
</sa-accordion>

Default open

Add the open attribute to an accordion item to open it by default.

<sa-accordion>
    <sa-accordion-item open>
        <sa-accordion-item-title>
            What payment methods do you accept?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            We accept all major credit and debit cards (Visa, Mastercard, Amex) and popular digital wallets like Apple
            Pay and Google Pay for your convenience.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item>
        <sa-accordion-item-title>
            When will I receive my booking confirmation?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Your confirmation and e-tickets are usually emailed within minutes. If not, please check your spam folder or
            view the details in your account's "My Trips" section.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item>
        <sa-accordion-item-title>
            Can I earn loyalty points or frequent flyer miles?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Yes, you can enter your frequent flyer number during flight booking. For hotels and packages, eligibility
            depends on the specific service provider's loyalty program rules.
        </sa-accordion-item-content>
    </sa-accordion-item>
</sa-accordion>

Disabled

Disable accordion items using the disabled attribute.

<sa-accordion>
    <sa-accordion-item>
        <sa-accordion-item-title>
            What payment methods do you accept?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            We accept all major credit and debit cards (Visa, Mastercard, Amex) and popular digital wallets like Apple
            Pay and Google Pay for your convenience.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item disabled>
        <sa-accordion-item-title>
            When will I receive my booking confirmation?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Your confirmation and e-tickets are usually emailed within minutes. If not, please check your spam folder or
            view the details in your account's "My Trips" section.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item>
        <sa-accordion-item-title>
            Can I earn loyalty points or frequent flyer miles?
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Yes, you can enter your frequent flyer number during flight booking. For hotels and packages, eligibility
            depends on the specific service provider's loyalty program rules.
        </sa-accordion-item-content>
    </sa-accordion-item>
</sa-accordion>

Contained

Set variant="AccordionVariant.Contained" on <sa-accordion> to display the items in a bordered box, with each title on a muted band. The example below also sets the icon attribute of <sa-accordion-item-title>, which displays an icon before the title and indents the content to line up with the title.

<sa-accordion variant="AccordionVariant.Contained">
    <sa-accordion-item open>
        <sa-accordion-item-title icon="plane">
            Flights
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Return flights from London Heathrow to Kyoto via Osaka Kansai, with 23 kg of checked baggage per traveler.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item>
        <sa-accordion-item-title icon="hotel">
            Accommodation
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            Seven nights at a traditional ryokan in Gion, with breakfast and dinner included.
        </sa-accordion-item-content>
    </sa-accordion-item>
    <sa-accordion-item>
        <sa-accordion-item-title icon="map">
            Excursions
        </sa-accordion-item-title>
        <sa-accordion-item-content>
            A guided day trip to Nara and an evening tea ceremony in Higashiyama.
        </sa-accordion-item-content>
    </sa-accordion-item>
</sa-accordion>

API Reference

<sa-accordion>

Renders a <div> element that wraps the accordion items.

AttributeTypeDefaultDescription
variantAccordionVariantDefaultThe visual style: Default, with lines between the items, or Contained, with the items in a bordered box.

<sa-accordion-item>

Renders a <details> element. Native <details> attributes such as name and open work as usual, and adding disabled renders the item as disabled.

<sa-accordion-item-title>

Renders a <summary> element and appends a chevron indicator icon after the title content.

AttributeTypeDefaultDescription
iconstringnullThe name of an icon displayed in a tile before the title.

<sa-accordion-item-content>

Renders a <div> element containing an inner content wrapper.

On this page