Accordion: how to have it collapsed by default #904
-
Using the following I would expect it to be collapsed by default, it is not though, what am I mising?
|
Beta Was this translation helpful? Give feedback.
Answered by
crftwrk
Dec 18, 2024
Replies: 1 comment
-
Class See https://getbootstrap.com/docs/5.3/components/accordion/#example <div id="accordionExample" class="accordion">
<div class="accordion-item">
<h2 class="accordion-header"><button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">HEADER</button></h2>
<div id="collapseOne" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
<div class="accordion-body">
CONTENT
</div>
</div>
</div>
</div> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
chopinesque
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Class
show
on collapse means that collapse is shown. So, removeshow
class on collapse and setaria-expanded="true"
tofalse
in the button and collapse is collapsed.See https://getbootstrap.com/docs/5.3/components/accordion/#example