diff options
author | Mark Otto <markdotto@gmail.com> | 2021-06-14 23:25:11 +0300 |
---|---|---|
committer | Mark Otto <otto@github.com> | 2021-07-06 06:22:29 +0300 |
commit | 359ed099e5b2f82bd602f2a6c45f43af8f2c87e8 (patch) | |
tree | da343e462e97568af72c13d0d7571fa94e5cf083 /site/content/docs | |
parent | 8bc89b273d078f57c2a11e9b9b0ff60daf7f8e21 (diff) |
Add horizontal collapse support
Diffstat (limited to 'site/content/docs')
-rw-r--r-- | site/content/docs/5.0/components/collapse.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/site/content/docs/5.0/components/collapse.md b/site/content/docs/5.0/components/collapse.md index ac84ca9649..3704fb636b 100644 --- a/site/content/docs/5.0/components/collapse.md +++ b/site/content/docs/5.0/components/collapse.md @@ -40,6 +40,29 @@ Generally, we recommend using a button with the `data-bs-target` attribute. Whil </div> {{< /example >}} +## Horizontal + +The collapse plugin also supports horizontal collapsing. Add the `.collapse-horizontal` modifier class to transition the `width` instead of `height` and set a `width` on the immediate child element. Feel free to write your own custom Sass, use inline styles, or use our [width utilities]({{< docsref "/utilities/sizing" >}}). + +{{< callout info >}} +Please note that while the example below has a `min-height` set to avoid excessive repaints in our docs, this is not explicitly required. **Only the `width` on the child element is required.** +{{< /callout >}} + +{{< example >}} +<p> + <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseWidthExample" aria-expanded="false" aria-controls="collapseWidthExample"> + Toggle width collapse + </button> +</p> +<div style="min-height: 120px;"> + <div class="collapse collapse-horizontal" id="collapseWidthExample"> + <div class="card card-body" style="width: 300px;"> + This is some placeholder content for a horizontal collapse. It's hidden by default and shown when triggered. + </div> + </div> +</div> +{{< /example >}} + ## Multiple targets A `<button>` or `<a>` can show and hide multiple elements by referencing them with a selector in its `href` or `data-bs-target` attribute. |