Skip to content

Accordion Examples

The examples below assume that you have imported the component and set up the theme.

Basic

Create a basic accordion with a visible header and hidden content. The summary slot holds the header, and everything else becomes the collapsible content.

Shipping and delivery

Orders placed before 2 PM ship the same day. Delivery takes 3 to 5 business days, and a tracking link arrives by email once the package leaves the warehouse.

--opened
An SVG in the marker slot.
State
<div class="accordion-basic">
<sv-accordion>
<span slot="summary">Shipping and delivery</span>
<p>
Orders placed before 2 PM ship the same day. Delivery takes 3 to 5 business days, and a
tracking link arrives by email once the package leaves the warehouse.
</p>
</sv-accordion>
</div>
<style>
.accordion-basic {
display: grid;
align-content: center;
max-inline-size: 38rem;
min-block-size: 18em;
margin-inline: auto;
}
</style>

Group

Keep only one accordion open at a time. Accordions that share a group name close each other, also when they are not siblings.

How do I reset my password?

Open the sign-in page, choose "Forgot password", and follow the link sent to your inbox.

Can I change my username?

Usernames can be changed once every 30 days from the account settings page.

How do I delete my account?

Account deletion sits at the bottom of the privacy settings and takes effect after 14 days.

<div class="accordion-group">
<sv-accordion group="faq" opened>
<span slot="summary">How do I reset my password?</span>
<p>Open the sign-in page, choose "Forgot password", and follow the link sent to your inbox.</p>
</sv-accordion>
<sv-accordion group="faq">
<span slot="summary">Can I change my username?</span>
<p>Usernames can be changed once every 30 days from the account settings page.</p>
</sv-accordion>
<sv-accordion group="faq">
<span slot="summary">How do I delete my account?</span>
<p>
Account deletion sits at the bottom of the privacy settings and takes effect after 14 days.
</p>
</sv-accordion>
</div>
<style>
.accordion-group {
display: grid;
gap: 0.75em;
max-inline-size: 38rem;
margin-inline: auto;
}
</style>