Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hartree <github@pjh.is>2021-04-14 23:43:52 +0300
committerGitHub <noreply@github.com>2021-04-14 23:43:52 +0300
commitcb24272544950461b68d47fb8e8b220e188b18c9 (patch)
tree5ace24c0561c757b2bdb7618273c85e57737399b /site/content/docs/5.0
parent84b8eda5d6b7d3c021c22d30da52e222eee60e38 (diff)
Add example: Panels stay open (#33553)
* Add example: Panels stay open * Set unique element IDs in the new example * Update language Co-authored-by: Mark Otto <markd.otto@gmail.com> Co-authored-by: Mark Otto <otto@github.com>
Diffstat (limited to 'site/content/docs/5.0')
-rw-r--r--site/content/docs/5.0/components/accordion.md45
1 files changed, 45 insertions, 0 deletions
diff --git a/site/content/docs/5.0/components/accordion.md b/site/content/docs/5.0/components/accordion.md
index 864ff90c54..a4ef8272e7 100644
--- a/site/content/docs/5.0/components/accordion.md
+++ b/site/content/docs/5.0/components/accordion.md
@@ -101,6 +101,51 @@ Add `.accordion-flush` to remove the default `background-color`, some borders, a
</div>
{{< /example >}}
+### Always open
+
+Omit the `data-bs-parent` attribute on each `.accordion-collapse` to make accordion items stay open when another item is opened.
+
+{{< example >}}
+<div class="accordion" id="accordionPanelsStayOpenExample">
+ <div class="accordion-item">
+ <h2 class="accordion-header" id="panelsStayOpen-headingOne">
+ <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseOne" aria-expanded="true" aria-controls="panelsStayOpen-collapseOne">
+ Accordion Item #1
+ </button>
+ </h2>
+ <div id="panelsStayOpen-collapseOne" class="accordion-collapse collapse show" aria-labelledby="panelsStayOpen-headingOne">
+ <div class="accordion-body">
+ <strong>This is the first item's accordion body.</strong> 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 <code>.accordion-body</code>, though the transition does limit overflow.
+ </div>
+ </div>
+ </div>
+ <div class="accordion-item">
+ <h2 class="accordion-header" id="panelsStayOpen-headingTwo">
+ <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseTwo" aria-expanded="false" aria-controls="panelsStayOpen-collapseTwo">
+ Accordion Item #2
+ </button>
+ </h2>
+ <div id="panelsStayOpen-collapseTwo" class="accordion-collapse collapse" aria-labelledby="panelsStayOpen-headingTwo">
+ <div class="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 class="accordion-item">
+ <h2 class="accordion-header" id="panelsStayOpen-headingThree">
+ <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseThree" aria-expanded="false" aria-controls="panelsStayOpen-collapseThree">
+ Accordion Item #3
+ </button>
+ </h2>
+ <div id="panelsStayOpen-collapseThree" class="accordion-collapse collapse" aria-labelledby="panelsStayOpen-headingThree">
+ <div class="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>
+{{< /example >}}
+
## Accessibility
Please read the [collapse accessibility section]({{< docsref "/components/collapse#accessibility" >}}) for more information.