Accordion Using the card component, you can extend the default collapse behavior to create an accordion. To properly achieve the accordion style, be sure to use .accordion as a wrapper.
Be sure to add
aria-expanded
to the control element. This attribute explicitly conveys the current state of the collapsible element tied to the control to screen readers and similar assistive technologies. If the collapsible element is closed by default, the attribute on the control element should have a value of aria-expanded="false"
. If you’ve set the collapsible element to be open by default using the show
class, set aria-expanded="true"
on the control instead.
Learn more about this plugin on bootstrap's official documentation.
Default Accordion
data-toggle="collapse"
and a data-target
to the element to automatically assign control of one or more collapsible elements. The data-target
attribute accepts a CSS selector to apply the collapse to. Be sure to add the class collapse
to the collapsible element. If you’d like it to default open, add the additional class show
.
To add accordion-like group management to a collapsible area, add the data attribute
data-parent="#selector"
. Refer to the demo to see this in action.
Accordion Outline
.accordion-outline
to .accordion
Accordion Clean layout
.accordion-clean
to .accordion
Accordion active state icons
.collapse
state using the classes .collapsed-reveal
and .collapsed-hidden
Make sure the
.collapsed-*
classes are inside the data-toggle="collapse"
element or adjacent to it
Accordion hover
.accordion-hover
to .accordion
Nested accordions