Accordion
Vue Accordion component
Responsive accordion built with the latest Bootstrap 5 and Vue 3. Accordion is a vertically collapsing element to show and hide content via class changes.
Build vertically collapsing accordions in combination with our Collapse JavaScript plugin.
How it works
The accordion uses collapse internally to make it collapsible.
Basic example
Click the accordions below to expand/collapse the accordion content.
MDBAccordionItem
, though the transition does limit overflow.
MDBAccordionItem
, though the transition does limit overflow.
MDBAccordionItem
, though the transition does limit overflow.
Flush
Add flush
to remove the default background-color
, some
borders, and some rounded corners to render accordions edge-to-edge with their parent
container.
Borderless
Add .accordion-borderless
to remove all the borders and add a background color to the active item.
.accordion-flush
class. This is the first item's accordion body.
.accordion-flush
class. This is the second item's accordion body.
Let's imagine this being filled with some actual content.
.accordion-flush
class. This is the third item's accordion body.
Nothing more exciting happening here in terms of content, but just filling up
the space to make it look, at least at first glance, a bit more representative
of how this would look in a real-world application.
With icons
You can easily add icons to the header of the accordion. Read icons docs to see all the available icons.
.accordion-body
, though the
transition does limit overflow.
.accordion-body
, though the
transition does limit overflow.
.accordion-body
, though the
transition does limit overflow.
Always open
To make accordion items stay open when another item is opened add stayOpen
property to the MDBAccordion
component.
MDBAccordionItem
, though the transition does limit overflow.
MDBAccordionItem
, though the transition does limit overflow.
MDBAccordionItem
, though the transition does limit overflow.
Accessibility
Please read the collapse accessibility section for more information.
Accordion - API
Import
Properties
MDBAccordion
Name | Type | Default | Description |
---|---|---|---|
tag
|
String | 'div' |
Defines tag of the MDBAccordion element |
flush
|
Boolean | false |
Removes the default background-color, some borders, and some rounded corners from the accordion items |
stayOpen
|
Boolean | false |
Makes accordion items stay open when another item is opened |
classes
|
String |
|
Allows for custom classes for the element wrapper |
v-model
|
String |
|
Sets accordion item with given id active |
MDBAccordionItem
Name | Type | Default | Description | Example |
---|---|---|---|---|
tag
|
String | 'div' |
Defines tag of the MDBAccordionItem element |
|
collapseId
|
String |
|
Defines item id of the MDBAccordionItem element. Property is required |
|
headerTitle
|
String |
|
Defines header title of the element | |
headerClasses
|
String |
|
Allows for custom classes for the header title element | |
bodyClasses
|
String |
|
Allows for custom classes for the body element of the item | |
itemClasses
|
String |
|
Allows for custom classes for the item wrapper |
CSS variables
As part of MDB’s evolving CSS variables approach, accordion now uses local CSS variables on
.accordion
for enhanced real-time customization. Values for the CSS variables
are set via Sass, so Sass customization is still supported, too.