

Photo: Sara Codair
Accordion
Introduction
The Natura11y accordion allows sections of content to expand and collapse while maintaining accessible semantic structure.
Default Accordion Behavior
Each accordion item consists of:
- A button that controls expansion
- A content panel
- Optional heading markup when the accordion needs semantic heading navigation
The following is a basic accordion component. All accordion panels are closed by default.
The monarch butterfly or simply monarch is a milkweed butterfly in the family Nymphalidae. Other common names, depending on region, include milkweed, common tiger, wanderer, and black veined brown. It may be the most familiar North American butterfly, and is considered an iconic pollinator species.
The black swallowtail, American swallowtail, or parsnip swallowtail, is a butterfly found throughout much of North America. It is the state butterfly of Oklahoma and New Jersey.
The cecropia moth is North America's largest native moth. It is a member of the family Saturniidae, or giant silk moths. Females have been documented with a wingspan of five to seven inches or more.
The elephant hawk moth or large elephant hawk moth, is a moth in the family Sphingidae. Its common name is derived from the caterpillar's resemblance to an elephant's trunk. It is most common in central Europe and is distributed throughout the Palearctic region.
The spicebush swallowtail or green-clouded butterfly, is a common black swallowtail butterfly found in North America. It has two subspecies, Papilio troilus troilus and Papilio troilus ilioneus, the latter found mainly in the Florida peninsula.
<div class="accordion">
<button class="accordion__button h5" id="acc-button-example-01" data-accordion="button" aria-controls="acc-panel-example-01" aria-expanded="false"> Danaus Plexippus </button>
<div class="accordion__panel" id="acc-panel-example-01" data-accordion="panel" aria-labelledby="acc-button-example-01" role="region"> <div class="accordion__panel__content"> <p>...</p> </div> </div>
</div>| Lines | Details |
|---|---|
| 1 | The parent This selector uses JavaScript to group a set of accordion buttons and panels with one another. |
| 3-10 | The child The The The The |
| 12-21 | The child The The The The The |
Semantic Headers
Accordion buttons can be wrapped in heading elements to support screen reader heading navigation. This follows the W3C APG accordion pattern. If an accordion group lives below a page’s <h2>, wrap each button in an <h3>.
The monarch butterfly or simply monarch is a milkweed butterfly in the family Nymphalidae. Other common names, depending on region, include milkweed, common tiger, wanderer, and black veined brown. It may be the most familiar North American butterfly, and is considered an iconic pollinator species.
The black swallowtail, American swallowtail, or parsnip swallowtail, is a butterfly found throughout much of North America. It is the state butterfly of Oklahoma and New Jersey.
The cecropia moth is North America's largest native moth. It is a member of the family Saturniidae, or giant silk moths. Females have been documented with a wingspan of five to seven inches or more.
The elephant hawk moth or large elephant hawk moth, is a moth in the family Sphingidae. Its common name is derived from the caterpillar's resemblance to an elephant's trunk. It is most common in central Europe and is distributed throughout the Palearctic region.
The spicebush swallowtail or green-clouded butterfly, is a common black swallowtail butterfly found in North America. It has two subspecies, Papilio troilus troilus and Papilio troilus ilioneus, the latter found mainly in the Florida peninsula.
<h3 data-accordion="heading">
<button class="accordion__button h5" id="acc-button-example-01" data-accordion="button" aria-controls="acc-panel-example-01" aria-expanded="false"> Danaus Plexippus </button>
</h3>
<div class="accordion__panel" id="acc-panel-example-01" data-accordion="panel" aria-labelledby="acc-button-example-01" role="region"> <div class="accordion__panel__content"> ... </div></div>Open by Default
You may want one accordion topic to be open when the page loads.
The monarch butterfly or simply monarch is a milkweed butterfly in the family Nymphalidae. Other common names, depending on region, include milkweed, common tiger, wanderer, and black veined brown. It may be the most familiar North American butterfly, and is considered an iconic pollinator species.
The black swallowtail, American swallowtail, or parsnip swallowtail, is a butterfly found throughout much of North America. It is the state butterfly of Oklahoma and New Jersey.
The cecropia moth is North America's largest native moth. It is a member of the family Saturniidae, or giant silk moths. Females have been documented with a wingspan of five to seven inches or more.
The elephant hawk moth or large elephant hawk moth, is a moth in the family Sphingidae. Its common name is derived from the caterpillar's resemblance to an elephant's trunk. It is most common in central Europe and is distributed throughout the Palearctic region.
The spicebush swallowtail or green-clouded butterfly, is a common black swallowtail butterfly found in North America. It has two subspecies, Papilio troilus troilus and Papilio troilus ilioneus, the latter found mainly in the Florida peninsula.
<button class="accordion__button h5" id="acc-button-example-01" data-accordion="button" aria-controls="acc-panel-example-01" aria-expanded="true"> Danaus Plexippus</button>
<div class="accordion__panel shown" id="acc-panel-example-01" data-accordion="panel" aria-labelledby="acc-button-example-01" role="region"> <div class="accordion__panel__content"> <p>The monarch butterfly or simply monarch is a milkweed butterfly...</p> </div></div>Active Text Underline
Add a <span> with the .text class inside the button to underline the label when the panel is open. This gives users a second visual signal beyond color alone.
The monarch butterfly or simply monarch is a milkweed butterfly in the family Nymphalidae. Other common names, depending on region, include milkweed, common tiger, wanderer, and black veined brown. It may be the most familiar North American butterfly, and is considered an iconic pollinator species.
The black swallowtail, American swallowtail, or parsnip swallowtail, is a butterfly found throughout much of North America. It is the state butterfly of Oklahoma and New Jersey.
The cecropia moth is North America's largest native moth. It is a member of the family Saturniidae, or giant silk moths. Females have been documented with a wingspan of five to seven inches or more.
The elephant hawk moth or large elephant hawk moth, is a moth in the family Sphingidae. Its common name is derived from the caterpillar's resemblance to an elephant's trunk. It is most common in central Europe and is distributed throughout the Palearctic region.
The spicebush swallowtail or green-clouded butterfly, is a common black swallowtail butterfly found in North America. It has two subspecies, Papilio troilus troilus and Papilio troilus ilioneus, the latter found mainly in the Florida peninsula.
<button class="accordion__button h5" id="acc-button-example-01" data-accordion="button" aria-controls="acc-panel-example-01" aria-expanded="false"> <span class="text">Danaus Plexippus</span></button>













































