Accordions

This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.

This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.

This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.

Accordion HTML-Code Example

1
2  // Accordion
3  <div class="accordion" id="accordionPanelsStayOpenExample">
4  <div class="accordion-item">
5    <h2 class="accordion-header" id="panelsStayOpen-headingOne">
6      <button
7        class="accordion-button collapsed"
8        type="button"
9        data-bs-toggle="collapse"
10        data-bs-target="#panelsStayOpen-collapseOne"
11        aria-expanded="false"
12        aria-controls="panelsStayOpen-collapseOne"
13      >
14        Accordion Item #1
15      </button>
16    </h2>
17    <div
18      id="panelsStayOpen-collapseOne"
19      class="accordion-collapse collapse"
20      aria-labelledby="panelsStayOpen-headingOne"
21    >
22      <div class="accordion-body">
23        <strong>This is the first item's accordion body.</strong> It is
24        shown by default, until the collapse plugin adds the appropriate
25        classes that we use to style each element. These classes control
26        the overall appearance, as well as the showing and hiding via CSS
27        transitions. You can modify any of this with custom CSS or
28        overriding our default variables. It's also worth noting that just
29        about any HTML can go within the <code>.accordion-body</code>,
30        though the transition does limit overflow.
31      </div>
32    </div>
33  </div>
34  <div class="accordion-item">
35    <h2 class="accordion-header" id="panelsStayOpen-headingTwo">
36      <button
37        class="accordion-button collapsed"
38        type="button"
39        data-bs-toggle="collapse"
40        data-bs-target="#panelsStayOpen-collapseTwo"
41        aria-expanded="false"
42        aria-controls="panelsStayOpen-collapseTwo"
43      >
44        Accordion Item #2
45      </button>
46    </h2>
47    <div
48      id="panelsStayOpen-collapseTwo"
49      class="accordion-collapse collapse"
50      aria-labelledby="panelsStayOpen-headingTwo"
51    >
52      <div class="accordion-body">
53        <strong>This is the second item's accordion body.</strong> It is
54        hidden by default, until the collapse plugin adds the appropriate
55        classes that we use to style each element. These classes control
56        the overall appearance, as well as the showing and hiding via CSS
57        transitions. You can modify any of this with custom CSS or
58        overriding our default variables. It's also worth noting that just
59        about any HTML can go within the <code>.accordion-body</code>,
60        though the transition does limit overflow.
61      </div>
62    </div>
63  </div>
64  <div class="accordion-item">
65    <h2 class="accordion-header" id="panelsStayOpen-headingThree">
66      <button
67        class="accordion-button collapsed"
68        type="button"
69        data-bs-toggle="collapse"
70        data-bs-target="#panelsStayOpen-collapseThree"
71        aria-expanded="false"
72        aria-controls="panelsStayOpen-collapseThree"
73      >
74        Accordion Item #3
75      </button>
76    </h2>
77    <div
78      id="panelsStayOpen-collapseThree"
79      class="accordion-collapse collapse"
80      aria-labelledby="panelsStayOpen-headingThree"
81    >
82      <div class="accordion-body">
83        <strong>This is the third item's accordion body.</strong> It is
84        hidden by default, until the collapse plugin adds the appropriate
85        classes that we use to style each element. These classes control
86        the overall appearance, as well as the showing and hiding via CSS
87        transitions. You can modify any of this with custom CSS or
88        overriding our default variables. It's also worth noting that just
89        about any HTML can go within the <code>.accordion-body</code>,
90        though the transition does limit overflow.
91      </div>
92    </div>
93  </div>
94</div>
95