Hello, I have a problem with the according in my app, I am pasting the code from the documentation, but after clicking on the according header it does not expand.
I'm using metronic 8 in react.
Hi,
The first accordion example in react doc has an error, I already included fix into v8.0.34 release.
For now please use example shown below.
<div className="accordion accordion-icon-toggle" id="kt_accordion_2">
<div className="accordion" id="kt_accordion_1">
<div className="accordion-item">
<h2 className="accordion-header" id="kt_accordion_1_header_1">
<button
className="accordion-button fs-4 fw-bold collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#kt_accordion_1_body_1"
aria-expanded="false"
aria-controls="kt_accordion_1_body_1"
>
Accordion Item #1
</button>
</h2>
<div
id="kt_accordion_1_body_1"
className="accordion-collapse collapse"
aria-labelledby="kt_accordion_1_header_1"
data-bs-parent="#kt_accordion_1"
>
<div className="accordion-body">
ACCORDION1
</div>
</div>
</div>
<div className="accordion-item">
<h2 className="accordion-header" id="kt_accordion_1_header_2">
<button
className="accordion-button fs-4 fw-bold collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#kt_accordion_1_body_2"
aria-expanded="false"
aria-controls="kt_accordion_1_body_2"
>
Accordion Item #2
</button>
</h2>
<div
id="kt_accordion_1_body_2"
className="accordion-collapse collapse"
aria-labelledby="kt_accordion_1_header_2"
data-bs-parent="#kt_accordion_1"
>
<div className="accordion-body">
ACCORDION2
</div>
</div>
</div>
<div className="accordion-item">
<h2 className="accordion-header" id="kt_accordion_1_header_3">
<button
className="accordion-button fs-4 fw-bold collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#kt_accordion_1_body_3"
aria-expanded="false"
aria-controls="kt_accordion_1_body_3"
>
Accordion Item #3
</button>
</h2>
<div
id="kt_accordion_1_body_3"
className="accordion-collapse collapse"
aria-labelledby="kt_accordion_1_header_3"
data-bs-parent="#kt_accordion_1"
>
<div className="accordion-body">
ACCORDION3
</div>
</div>
</div>
</div>
</div>
The given solution did not bring anything, Accrording still does not work.
I just rechecked this example and it works fine in the latest Metronic version.
Can you please specify which version are you using?
If you made any changes in our codebase please describe them as well.
Thank you!
Hi,
First code example in the doc has an error I already included a fix for v8.0.34.
For now please use code example below:<div className="accordion accordion-icon-toggle" id="kt_accordion_2">
<div className="accordion" id="kt_accordion_1">
<div className="accordion-item">
<h2 className="accordion-header" id="kt_accordion_1_header_1">
<button
className="accordion-button fs-4 fw-bold collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#kt_accordion_1_body_1"
aria-expanded="false"
aria-controls="kt_accordion_1_body_1"
>
Accordion Item #1
</button>
</h2>
<div
id="kt_accordion_1_body_1"
className="accordion-collapse collapse"
aria-labelledby="kt_accordion_1_header_1"
data-bs-parent="#kt_accordion_1"
>
<div className="accordion-body">
<strong>This is the first item"s accordion body.</strong>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<code>.accordion-body</code>, though the transition does limit overflow.
</div>
</div>
</div>
<div className="accordion-item">
<h2 className="accordion-header" id="kt_accordion_1_header_2">
<button
className="accordion-button fs-4 fw-bold collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#kt_accordion_1_body_2"
aria-expanded="false"
aria-controls="kt_accordion_1_body_2"
>
Accordion Item #2
</button>
</h2>
<div
id="kt_accordion_1_body_2"
className="accordion-collapse collapse"
aria-labelledby="kt_accordion_1_header_2"
data-bs-parent="#kt_accordion_1"
>
<div className="accordion-body">
<strong>This is the second item"s accordion body.</strong>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<code>.accordion-body</code>, though the transition does limit overflow.
</div>
</div>
</div>
<div className="accordion-item">
<h2 className="accordion-header" id="kt_accordion_1_header_3">
<button
className="accordion-button fs-4 fw-bold collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#kt_accordion_1_body_3"
aria-expanded="false"
aria-controls="kt_accordion_1_body_3"
>
Accordion Item #3
</button>
</h2>
<div
id="kt_accordion_1_body_3"
className="accordion-collapse collapse"
aria-labelledby="kt_accordion_1_header_3"
data-bs-parent="#kt_accordion_1"
>
<div className="accordion-body">
<strong>This is the third item"s accordion body.</strong>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<code>.accordion-body</code>, though the transition does limit overflow.
</div>
</div>
</div>
</div>
</div>