diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-24 12:44:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-24 12:44:36 +0000 |
commit | c1d5a801b4bc66e3866f815be00e11d1b20d3539 (patch) | |
tree | 394cfedf644640ac80b78aaddaff93ceb8eefa5e /site/content/docs/5.2/components | |
parent | Adding upstream version 5.2.3+dfsg. (diff) | |
download | bootstrap-html-c1d5a801b4bc66e3866f815be00e11d1b20d3539.tar.xz bootstrap-html-c1d5a801b4bc66e3866f815be00e11d1b20d3539.zip |
Adding upstream version 5.3.0+dfsg.upstream/5.3.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | site/content/docs/5.2/components/close-button.md | 38 | ||||
-rw-r--r-- | site/content/docs/5.2/components/progress.md | 154 | ||||
-rw-r--r-- | site/content/docs/5.3/components/accordion.md (renamed from site/content/docs/5.2/components/accordion.md) | 44 | ||||
-rw-r--r-- | site/content/docs/5.3/components/alerts.md (renamed from site/content/docs/5.2/components/alerts.md) | 35 | ||||
-rw-r--r-- | site/content/docs/5.3/components/badge.md (renamed from site/content/docs/5.2/components/badge.md) | 2 | ||||
-rw-r--r-- | site/content/docs/5.3/components/breadcrumb.md (renamed from site/content/docs/5.2/components/breadcrumb.md) | 5 | ||||
-rw-r--r-- | site/content/docs/5.3/components/button-group.md (renamed from site/content/docs/5.2/components/button-group.md) | 38 | ||||
-rw-r--r-- | site/content/docs/5.3/components/buttons.md (renamed from site/content/docs/5.2/components/buttons.md) | 20 | ||||
-rw-r--r-- | site/content/docs/5.3/components/card.md (renamed from site/content/docs/5.2/components/card.md) | 38 | ||||
-rw-r--r-- | site/content/docs/5.3/components/carousel.md (renamed from site/content/docs/5.2/components/carousel.md) | 179 | ||||
-rw-r--r-- | site/content/docs/5.3/components/collapse.md (renamed from site/content/docs/5.2/components/collapse.md) | 18 | ||||
-rw-r--r-- | site/content/docs/5.3/components/dropdowns.md (renamed from site/content/docs/5.2/components/dropdowns.md) | 45 | ||||
-rw-r--r-- | site/content/docs/5.3/components/list-group.md (renamed from site/content/docs/5.2/components/list-group.md) | 32 | ||||
-rw-r--r-- | site/content/docs/5.3/components/modal.md (renamed from site/content/docs/5.2/components/modal.md) | 43 | ||||
-rw-r--r-- | site/content/docs/5.3/components/navbar.md (renamed from site/content/docs/5.2/components/navbar.md) | 90 | ||||
-rw-r--r-- | site/content/docs/5.3/components/navs-tabs.md (renamed from site/content/docs/5.2/components/navs-tabs.md) | 31 | ||||
-rw-r--r-- | site/content/docs/5.3/components/offcanvas.md (renamed from site/content/docs/5.2/components/offcanvas.md) | 16 | ||||
-rw-r--r-- | site/content/docs/5.3/components/pagination.md (renamed from site/content/docs/5.2/components/pagination.md) | 0 | ||||
-rw-r--r-- | site/content/docs/5.3/components/placeholders.md (renamed from site/content/docs/5.2/components/placeholders.md) | 12 | ||||
-rw-r--r-- | site/content/docs/5.3/components/popovers.md (renamed from site/content/docs/5.2/components/popovers.md) | 28 | ||||
-rw-r--r-- | site/content/docs/5.3/components/scrollspy.md (renamed from site/content/docs/5.2/components/scrollspy.md) | 10 | ||||
-rw-r--r-- | site/content/docs/5.3/components/spinners.md (renamed from site/content/docs/5.2/components/spinners.md) | 4 | ||||
-rw-r--r-- | site/content/docs/5.3/components/toasts.md (renamed from site/content/docs/5.2/components/toasts.md) | 44 | ||||
-rw-r--r-- | site/content/docs/5.3/components/tooltips.md (renamed from site/content/docs/5.2/components/tooltips.md) | 31 |
24 files changed, 415 insertions, 542 deletions
diff --git a/site/content/docs/5.2/components/close-button.md b/site/content/docs/5.2/components/close-button.md deleted file mode 100644 index f4a3ed0..0000000 --- a/site/content/docs/5.2/components/close-button.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -layout: docs -title: Close button -description: A generic close button for dismissing content like modals and alerts. -group: components -toc: true ---- - -## Example - -Provide an option to dismiss or close a component with `.btn-close`. Default styling is limited, but highly customizable. Modify the Sass variables to replace the default `background-image`. **Be sure to include text for screen readers**, as we've done with `aria-label`. - -{{< example >}} -<button type="button" class="btn-close" aria-label="Close"></button> -{{< /example >}} - -## Disabled state - -Disabled close buttons change their `opacity`. We've also applied `pointer-events: none` and `user-select: none` to preventing hover and active states from triggering. - -{{< example >}} -<button type="button" class="btn-close" disabled aria-label="Close"></button> -{{< /example >}} - -## White variant - -Change the default `.btn-close` to be white with the `.btn-close-white` class. This class uses the `filter` property to invert the `background-image`. - -{{< example class="bg-dark" >}} -<button type="button" class="btn-close btn-close-white" aria-label="Close"></button> -<button type="button" class="btn-close btn-close-white" disabled aria-label="Close"></button> -{{< /example >}} - -## Sass - -### Variables - -{{< scss-docs name="close-variables" file="scss/_variables.scss" >}} diff --git a/site/content/docs/5.2/components/progress.md b/site/content/docs/5.2/components/progress.md deleted file mode 100644 index aa79368..0000000 --- a/site/content/docs/5.2/components/progress.md +++ /dev/null @@ -1,154 +0,0 @@ ---- -layout: docs -title: Progress -description: Documentation and examples for using Bootstrap custom progress bars featuring support for stacked bars, animated backgrounds, and text labels. -group: components -toc: true ---- - -## How it works - -Progress components are built with two HTML elements, some CSS to set the width, and a few attributes. We don't use [the HTML5 `<progress>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress), ensuring you can stack progress bars, animate them, and place text labels over them. - -- We use the `.progress` as a wrapper to indicate the max value of the progress bar. -- We use the inner `.progress-bar` to indicate the progress so far. -- The `.progress-bar` requires an inline style, utility class, or custom CSS to set their width. -- The `.progress-bar` also requires some `role` and `aria` attributes to make it accessible, including an accessible name (using `aria-label`, `aria-labelledby`, or similar). - -Put that all together, and you have the following examples. - -{{< example >}} -<div class="progress"> - <div class="progress-bar" role="progressbar" aria-label="Basic example" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div> -</div> -{{< /example >}} - -Bootstrap provides a handful of [utilities for setting width]({{< docsref "/utilities/sizing" >}}). Depending on your needs, these may help with quickly configuring progress. - -{{< example >}} -<div class="progress"> - <div class="progress-bar w-75" role="progressbar" aria-label="Basic example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> -</div> -{{< /example >}} - -## Labels - -Add labels to your progress bars by placing text within the `.progress-bar`. - -{{< example >}} -<div class="progress"> - <div class="progress-bar" role="progressbar" aria-label="Example with label" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div> -</div> -{{< /example >}} - -## Height - -We only set a `height` value on the `.progress`, so if you change that value the inner `.progress-bar` will automatically resize accordingly. - -{{< example >}} -<div class="progress" style="height: 1px;"> - <div class="progress-bar" role="progressbar" aria-label="Example 1px high" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress" style="height: 20px;"> - <div class="progress-bar" role="progressbar" aria-label="Example 20px high" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> -</div> -{{< /example >}} - -## Backgrounds - -Use background utility classes to change the appearance of individual progress bars. - -{{< example >}} -<div class="progress"> - <div class="progress-bar bg-success" role="progressbar" aria-label="Success example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar bg-info" role="progressbar" aria-label="Info example" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar bg-warning" role="progressbar" aria-label="Warning example" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar bg-danger" role="progressbar" aria-label="Danger example" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div> -</div> -{{< /example >}} - -{{< callout info >}} -{{< partial "callout-warning-color-assistive-technologies.md" >}} -{{< /callout >}} - -## Multiple bars - -Include multiple progress bars in a progress component if you need. - -{{< example >}} -<div class="progress"> - <div class="progress-bar" role="progressbar" aria-label="Segment one" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div> - <div class="progress-bar bg-success" role="progressbar" aria-label="Segment two" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div> - <div class="progress-bar bg-info" role="progressbar" aria-label="Segment three" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div> -</div> -{{< /example >}} - -## Striped - -Add `.progress-bar-striped` to any `.progress-bar` to apply a stripe via CSS gradient over the progress bar's background color. - -{{< example >}} -<div class="progress"> - <div class="progress-bar progress-bar-striped" role="progressbar" aria-label="Default striped example" style="width: 10%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar progress-bar-striped bg-success" role="progressbar" aria-label="Success striped example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar progress-bar-striped bg-info" role="progressbar" aria-label="Info striped example" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar progress-bar-striped bg-warning" role="progressbar" aria-label="Warning striped example" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> -</div> -<div class="progress"> - <div class="progress-bar progress-bar-striped bg-danger" role="progressbar" aria-label="Danger striped example" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div> -</div> -{{< /example >}} - -## Animated stripes - -The striped gradient can also be animated. Add `.progress-bar-animated` to `.progress-bar` to animate the stripes right to left via CSS3 animations. - -{{< example >}} -<div class="progress"> - <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-label="Animated striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div> -</div> -{{< /example >}} - -## CSS - -### Variables - -{{< added-in "5.2.0" >}} - -As part of Bootstrap's evolving CSS variables approach, progress bars now use local CSS variables on `.progress` for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too. - -{{< scss-docs name="progress-css-vars" file="scss/_progress.scss" >}} - -### Sass variables - -{{< scss-docs name="progress-variables" file="scss/_variables.scss" >}} - -### Keyframes - -Used for creating the CSS animations for `.progress-bar-animated`. Included in `scss/_progress-bar.scss`. - -{{< scss-docs name="progress-keyframes" file="scss/_progress.scss" >}} diff --git a/site/content/docs/5.2/components/accordion.md b/site/content/docs/5.3/components/accordion.md index 2e24723..227d11a 100644 --- a/site/content/docs/5.2/components/accordion.md +++ b/site/content/docs/5.3/components/accordion.md @@ -5,7 +5,7 @@ description: Build vertically collapsing accordions in combination with our Coll group: components aliases: - "/components/" - - "/docs/5.2/components/" + - "/docs/5.3/components/" toc: true --- @@ -14,7 +14,7 @@ toc: true The accordion uses [collapse]({{< docsref "/components/collapse" >}}) internally to make it collapsible. To render an accordion that's expanded, add the `.open` class on the `.accordion`. {{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} {{< /callout >}} ## Example @@ -24,36 +24,36 @@ Click the accordions below to expand/collapse the accordion content. {{< example >}} <div class="accordion" id="accordionExample"> <div class="accordion-item"> - <h2 class="accordion-header" id="headingOne"> + <h2 class="accordion-header"> <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> Accordion Item #1 </button> </h2> - <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample"> + <div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordionExample"> <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="headingTwo"> + <h2 class="accordion-header"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> Accordion Item #2 </button> </h2> - <div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample"> + <div id="collapseTwo" class="accordion-collapse collapse" data-bs-parent="#accordionExample"> <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="headingThree"> + <h2 class="accordion-header"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> Accordion Item #3 </button> </h2> - <div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample"> + <div id="collapseThree" class="accordion-collapse collapse" data-bs-parent="#accordionExample"> <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> @@ -64,37 +64,37 @@ Click the accordions below to expand/collapse the accordion content. ### Flush -Add `.accordion-flush` to remove the default `background-color`, some borders, and some rounded corners to render accordions edge-to-edge with their parent container. +Add `.accordion-flush` to remove some borders and rounded corners to render accordions edge-to-edge with their parent container. -{{< example class="bg-light" >}} +{{< example class="bg-body-secondary" >}} <div class="accordion accordion-flush" id="accordionFlushExample"> <div class="accordion-item"> - <h2 class="accordion-header" id="flush-headingOne"> + <h2 class="accordion-header"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne"> Accordion Item #1 </button> </h2> - <div id="flush-collapseOne" class="accordion-collapse collapse" aria-labelledby="flush-headingOne" data-bs-parent="#accordionFlushExample"> + <div id="flush-collapseOne" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample"> <div class="accordion-body">Placeholder content for this accordion, which is intended to demonstrate the <code>.accordion-flush</code> class. This is the first item's accordion body.</div> </div> </div> <div class="accordion-item"> - <h2 class="accordion-header" id="flush-headingTwo"> + <h2 class="accordion-header"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseTwo" aria-expanded="false" aria-controls="flush-collapseTwo"> Accordion Item #2 </button> </h2> - <div id="flush-collapseTwo" class="accordion-collapse collapse" aria-labelledby="flush-headingTwo" data-bs-parent="#accordionFlushExample"> + <div id="flush-collapseTwo" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample"> <div class="accordion-body">Placeholder content for this accordion, which is intended to demonstrate the <code>.accordion-flush</code> class. This is the second item's accordion body. Let's imagine this being filled with some actual content.</div> </div> </div> <div class="accordion-item"> - <h2 class="accordion-header" id="flush-headingThree"> + <h2 class="accordion-header"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseThree" aria-expanded="false" aria-controls="flush-collapseThree"> Accordion Item #3 </button> </h2> - <div id="flush-collapseThree" class="accordion-collapse collapse" aria-labelledby="flush-headingThree" data-bs-parent="#accordionFlushExample"> + <div id="flush-collapseThree" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample"> <div class="accordion-body">Placeholder content for this accordion, which is intended to demonstrate the <code>.accordion-flush</code> class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.</div> </div> </div> @@ -108,36 +108,36 @@ Omit the `data-bs-parent` attribute on each `.accordion-collapse` to make accord {{< example >}} <div class="accordion" id="accordionPanelsStayOpenExample"> <div class="accordion-item"> - <h2 class="accordion-header" id="panelsStayOpen-headingOne"> + <h2 class="accordion-header"> <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 id="panelsStayOpen-collapseOne" class="accordion-collapse collapse show"> <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"> + <h2 class="accordion-header"> <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 id="panelsStayOpen-collapseTwo" class="accordion-collapse collapse"> <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"> + <h2 class="accordion-header"> <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 id="panelsStayOpen-collapseThree" class="accordion-collapse collapse"> <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> diff --git a/site/content/docs/5.2/components/alerts.md b/site/content/docs/5.3/components/alerts.md index 8837ed4..d634ce2 100644 --- a/site/content/docs/5.2/components/alerts.md +++ b/site/content/docs/5.3/components/alerts.md @@ -10,6 +10,10 @@ toc: true Alerts are available for any length of text, as well as an optional close button. For proper styling, use one of the eight **required** contextual classes (e.g., `.alert-success`). For inline dismissal, use the [alerts JavaScript plugin](#dismissing). +{{< callout info >}} +**Heads up!** As of v5.3.0, the `alert-variant()` Sass mixin is deprecated. Alert variants now have their CSS variables overridden in [a Sass loop](#sass-loops). +{{< /callout >}} + {{< example >}} {{< alerts.inline >}} {{- range (index $.Site.Data "theme-colors") }} @@ -20,7 +24,7 @@ Alerts are available for any length of text, as well as an optional close button {{< /example >}} {{< callout info >}} -{{< partial "callout-warning-color-assistive-technologies.md" >}} +{{< partial "callouts/warning-color-assistive-technologies.md" >}} {{< /callout >}} ### Live example @@ -34,28 +38,7 @@ Click the button below to show an alert (hidden with inline styles to start), th We use the following JavaScript to trigger our live alert demo: -```js -const alertPlaceholder = document.getElementById('liveAlertPlaceholder') - -const alert = (message, type) => { - const wrapper = document.createElement('div') - wrapper.innerHTML = [ - `<div class="alert alert-${type} alert-dismissible" role="alert">`, - ` <div>${message}</div>`, - ' <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>', - '</div>' - ].join('') - - alertPlaceholder.append(wrapper) -} - -const alertTrigger = document.getElementById('liveAlertBtn') -if (alertTrigger) { - alertTrigger.addEventListener('click', () => { - alert('Nice, you triggered this alert message!', 'success') - }) -} -``` +{{< js-docs name="live-alert" file="site/assets/js/snippets.js" >}} ### Link color @@ -175,13 +158,15 @@ As part of Bootstrap's evolving CSS variables approach, alerts now use local CSS {{< scss-docs name="alert-variables" file="scss/_variables.scss" >}} -### Sass mixin +### Sass mixins + +{{< deprecated-in "5.3.0" >}} Used in combination with `$theme-colors` to create contextual modifier classes for our alerts. {{< scss-docs name="alert-variant-mixin" file="scss/mixins/_alert.scss" >}} -### Sass loop +### Sass loops Loop that generates the modifier classes with the `alert-variant()` mixin. diff --git a/site/content/docs/5.2/components/badge.md b/site/content/docs/5.3/components/badge.md index 55b1ffb..c073878 100644 --- a/site/content/docs/5.2/components/badge.md +++ b/site/content/docs/5.3/components/badge.md @@ -74,7 +74,7 @@ Set a `background-color` with contrasting foreground `color` with [our `.text-bg {{< /example >}} {{< callout info >}} -{{< partial "callout-warning-color-assistive-technologies.md" >}} +{{< partial "callouts/warning-color-assistive-technologies.md" >}} {{< /callout >}} ## Pill badges diff --git a/site/content/docs/5.2/components/breadcrumb.md b/site/content/docs/5.3/components/breadcrumb.md index 0012f97..fc68fc5 100644 --- a/site/content/docs/5.2/components/breadcrumb.md +++ b/site/content/docs/5.3/components/breadcrumb.md @@ -54,11 +54,8 @@ $breadcrumb-divider: quote(">"); It's also possible to use an **embedded SVG icon**. Apply it via our CSS custom property, or use the Sass variable. - {{< callout info >}} -### Using embedded SVG - -Inlining SVG as data URI requires to URL escape a few characters, most notably `<`, `>` and `#`. That's why the `$breadcrumb-divider` variable is passed through our [`escape-svg()` Sass function]({{< docsref "/customize/sass#escape-svg" >}}). When using the CSS custom property, you need to URL escape your SVG on your own. Read [Kevin Weber's explanations on CodePen](https://codepen.io/kevinweber/pen/dXWoRw ) for detailed information on what to escape. +**Inlined SVG requires properly escaped characters.** Some reserved characters, such as `<`, `>` and `#`, must be URL-encoded or escaped. We do this with the `$breadcrumb-divider` variable using our [`escape-svg()` Sass function]({{< docsref "/customize/sass#escape-svg" >}}). When customizing the CSS variable, you must handle this yourself. Read [Kevin Weber's explanations on CodePen](https://codepen.io/kevinweber/pen/dXWoRw ) for more info. {{< /callout >}} {{< example >}} diff --git a/site/content/docs/5.2/components/button-group.md b/site/content/docs/5.3/components/button-group.md index 8f7d2d6..9c63562 100644 --- a/site/content/docs/5.2/components/button-group.md +++ b/site/content/docs/5.3/components/button-group.md @@ -18,12 +18,8 @@ Wrap a series of buttons with `.btn` in `.btn-group`. </div> {{< /example >}} -{{< callout warning >}} -##### Ensure correct `role` and provide a label - -In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate `role` attribute needs to be provided. For button groups, this would be `role="group"`, while toolbars should have a `role="toolbar"`. - -In addition, groups and toolbars should be given an explicit label, as most assistive technologies will otherwise not announce them, despite the presence of the correct role attribute. In the examples provided here, we use `aria-label`, but alternatives such as `aria-labelledby` can also be used. +{{< callout info >}} +Button groups require an appropriate `role` attribute and explicit label to ensure assistive technologies like screen readers identify buttons as grouped and announce them. Use `role="group"` for button groups or `role="toolbar"` for button toolbars. Then use `aria-label` or `aria-labelledby` to label them. {{< /callout >}} These classes can also be added to groups of links, as an alternative to the [`.nav` navigation components]({{< docsref "/components/navs-tabs" >}}). @@ -145,21 +141,21 @@ Instead of applying button sizing classes to every button in a group, just add ` {{< example >}} <div class="btn-group btn-group-lg" role="group" aria-label="Large button group"> - <button type="button" class="btn btn-outline-dark">Left</button> - <button type="button" class="btn btn-outline-dark">Middle</button> - <button type="button" class="btn btn-outline-dark">Right</button> + <button type="button" class="btn btn-outline-primary">Left</button> + <button type="button" class="btn btn-outline-primary">Middle</button> + <button type="button" class="btn btn-outline-primary">Right</button> </div> <br> <div class="btn-group" role="group" aria-label="Default button group"> - <button type="button" class="btn btn-outline-dark">Left</button> - <button type="button" class="btn btn-outline-dark">Middle</button> - <button type="button" class="btn btn-outline-dark">Right</button> + <button type="button" class="btn btn-outline-primary">Left</button> + <button type="button" class="btn btn-outline-primary">Middle</button> + <button type="button" class="btn btn-outline-primary">Right</button> </div> <br> <div class="btn-group btn-group-sm" role="group" aria-label="Small button group"> - <button type="button" class="btn btn-outline-dark">Left</button> - <button type="button" class="btn btn-outline-dark">Middle</button> - <button type="button" class="btn btn-outline-dark">Right</button> + <button type="button" class="btn btn-outline-primary">Left</button> + <button type="button" class="btn btn-outline-primary">Middle</button> + <button type="button" class="btn btn-outline-primary">Right</button> </div> {{< /example >}} @@ -190,12 +186,12 @@ Make a set of buttons appear vertically stacked rather than horizontally. **Spli {{< example >}} <div class="btn-group-vertical" role="group" aria-label="Vertical button group"> - <button type="button" class="btn btn-dark">Button</button> - <button type="button" class="btn btn-dark">Button</button> - <button type="button" class="btn btn-dark">Button</button> - <button type="button" class="btn btn-dark">Button</button> - <button type="button" class="btn btn-dark">Button</button> - <button type="button" class="btn btn-dark">Button</button> + <button type="button" class="btn btn-primary">Button</button> + <button type="button" class="btn btn-primary">Button</button> + <button type="button" class="btn btn-primary">Button</button> + <button type="button" class="btn btn-primary">Button</button> + <button type="button" class="btn btn-primary">Button</button> + <button type="button" class="btn btn-primary">Button</button> </div> {{< /example >}} diff --git a/site/content/docs/5.2/components/buttons.md b/site/content/docs/5.3/components/buttons.md index c2fdd75..ae58fca 100644 --- a/site/content/docs/5.2/components/buttons.md +++ b/site/content/docs/5.3/components/buttons.md @@ -6,9 +6,23 @@ group: components toc: true --- -## Examples +## Base class -Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control. +Bootstrap has a base `.btn` class that sets up basic styles such as padding and content alignment. By default, `.btn` controls have a transparent border and background color, and lack any explicit focus and hover styles. + +{{< example >}} +<button type="button" class="btn">Base class</button> +{{< /example >}} + +The `.btn` class is intended to be used in conjunction with our button variants, or to serve as a basis for your own custom styles. + +{{< callout warning >}} +If you are using the `.btn` class on its own, remember to at least define some explicit `:focus` and/or `:focus-visible` styles. +{{< /callout >}} + +## Variants + +Bootstrap includes several button variants, each serving its own semantic purpose, with a few extras thrown in for more control. {{< example >}} {{< buttons.inline >}} @@ -21,7 +35,7 @@ Bootstrap includes several predefined button styles, each serving its own semant {{< /example >}} {{< callout info >}} -{{< partial "callout-warning-color-assistive-technologies.md" >}} +{{< partial "callouts/warning-color-assistive-technologies.md" >}} {{< /callout >}} ## Disable text wrapping diff --git a/site/content/docs/5.2/components/card.md b/site/content/docs/5.3/components/card.md index 6bc90e7..2ad32b4 100644 --- a/site/content/docs/5.2/components/card.md +++ b/site/content/docs/5.3/components/card.md @@ -53,7 +53,7 @@ Subtitles are used by adding a `.card-subtitle` to a `<h*>` tag. If the `.card-t <div class="card" style="width: 18rem;"> <div class="card-body"> <h5 class="card-title">Card title</h5> - <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6> + <h6 class="card-subtitle mb-2 text-body-secondary">Card subtitle</h6> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="card-link">Card link</a> <a href="#" class="card-link">Another link</a> @@ -191,7 +191,7 @@ Card headers can be styled by adding `.card-header` to `<h*>` elements. <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> - <div class="card-footer text-muted"> + <div class="card-footer text-body-secondary"> 2 days ago </div> </div> @@ -207,7 +207,7 @@ Using the grid, wrap cards in columns and rows as needed. {{< example >}} <div class="row"> - <div class="col-sm-6"> + <div class="col-sm-6 mb-3 mb-sm-0"> <div class="card"> <div class="card-body"> <h5 class="card-title">Special title treatment</h5> @@ -233,7 +233,7 @@ Using the grid, wrap cards in columns and rows as needed. Use our handful of [available sizing utilities]({{< docsref "/utilities/sizing" >}}) to quickly set a card's width. {{< example >}} -<div class="card w-75"> +<div class="card w-75 mb-3"> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> @@ -269,7 +269,7 @@ Use custom CSS in your stylesheets or as inline styles to set a width. You can quickly change the text alignment of any card—in its entirety or specific parts—with our [text align classes]({{< docsref "/utilities/text#text-alignment" >}}). {{< example >}} -<div class="card" style="width: 18rem;"> +<div class="card mb-3" style="width: 18rem;"> <div class="card-body"> <h5 class="card-title">Special title treatment</h5> <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> @@ -277,7 +277,7 @@ You can quickly change the text alignment of any card—in its entirety or speci </div> </div> -<div class="card text-center" style="width: 18rem;"> +<div class="card text-center mb-3" style="width: 18rem;"> <div class="card-body"> <h5 class="card-title">Special title treatment</h5> <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> @@ -358,14 +358,14 @@ Similar to headers and footers, cards can include top and bottom "image caps"— <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> - <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p> </div> </div> <div class="card"> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> - <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p> </div> {{< placeholder width="100%" height="180" class="card-img-bottom" text="Image cap" >}} </div> @@ -404,7 +404,7 @@ Using a combination of grid and utility classes, cards can be made horizontal in <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> - <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p> </div> </div> </div> @@ -436,7 +436,7 @@ Set a `background-color` with contrasting foreground `color` with [our `.text-bg {{< /example >}} {{< callout info >}} -{{< partial "callout-warning-color-assistive-technologies.md" >}} +{{< partial "callouts/warning-color-assistive-technologies.md" >}} {{< /callout >}} ### Border @@ -487,7 +487,7 @@ Use card groups to render cards as a single, attached element with equal width a <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> - <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p> </div> </div> <div class="card"> @@ -495,7 +495,7 @@ Use card groups to render cards as a single, attached element with equal width a <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p> - <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p> </div> </div> <div class="card"> @@ -503,7 +503,7 @@ Use card groups to render cards as a single, attached element with equal width a <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p> - <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> + <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p> </div> </div> </div> @@ -520,7 +520,7 @@ When using card groups with footers, their content will automatically line up. <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> </div> <div class="card-footer"> - <small class="text-muted">Last updated 3 mins ago</small> + <small class="text-body-secondary">Last updated 3 mins ago</small> </div> </div> <div class="card"> @@ -530,7 +530,7 @@ When using card groups with footers, their content will automatically line up. <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p> </div> <div class="card-footer"> - <small class="text-muted">Last updated 3 mins ago</small> + <small class="text-body-secondary">Last updated 3 mins ago</small> </div> </div> <div class="card"> @@ -540,7 +540,7 @@ When using card groups with footers, their content will automatically line up. <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p> </div> <div class="card-footer"> - <small class="text-muted">Last updated 3 mins ago</small> + <small class="text-body-secondary">Last updated 3 mins ago</small> </div> </div> </div> @@ -689,7 +689,7 @@ Just like with card groups, card footers will automatically line up. <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> </div> <div class="card-footer"> - <small class="text-muted">Last updated 3 mins ago</small> + <small class="text-body-secondary">Last updated 3 mins ago</small> </div> </div> </div> @@ -701,7 +701,7 @@ Just like with card groups, card footers will automatically line up. <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p> </div> <div class="card-footer"> - <small class="text-muted">Last updated 3 mins ago</small> + <small class="text-body-secondary">Last updated 3 mins ago</small> </div> </div> </div> @@ -713,7 +713,7 @@ Just like with card groups, card footers will automatically line up. <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p> </div> <div class="card-footer"> - <small class="text-muted">Last updated 3 mins ago</small> + <small class="text-body-secondary">Last updated 3 mins ago</small> </div> </div> </div> diff --git a/site/content/docs/5.2/components/carousel.md b/site/content/docs/5.3/components/carousel.md index e32ce64..422f0aa 100644 --- a/site/content/docs/5.2/components/carousel.md +++ b/site/content/docs/5.3/components/carousel.md @@ -8,48 +8,24 @@ toc: true ## How it works -The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It works with a series of images, text, or custom markup. It also includes support for previous/next controls and indicators. +- The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It works with a series of images, text, or custom markup. It also includes support for previous/next controls and indicators. -In browsers where the [Page Visibility API](https://www.w3.org/TR/page-visibility/) is supported, the carousel will avoid sliding when the webpage is not visible to the user (such as when the browser tab is inactive, the browser window is minimized, etc.). +- For performance reasons, **carousels must be manually initialized** using the [carousel constructor method](#methods). Without initialization, some of the event listeners (specifically, the events needed touch/swipe support) will not be registered until a user has explicitly activated a control or indicator. -{{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} -{{< /callout >}} - -Please be aware that nested carousels are not supported, and carousels are generally not compliant with accessibility standards. - -## Example - -Carousels don't automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they're not explicitly required. Add and customize as you see fit. - -**The `.active` class needs to be added to one of the slides** otherwise the carousel will not be visible. Also be sure to set a unique `id` on the `.carousel` for optional controls, especially if you're using multiple carousels on a single page. Control and indicator elements must have a `data-bs-target` attribute (or `href` for links) that matches the `id` of the `.carousel` element. + The only exception are [autoplaying carousels](#autoplaying-carousels) with the `data-bs-ride="carousel"` attribute as these are initialized automatically on page load. If you're using autoplaying carousels with the data attribute, **don't explicitly initialize the same carousels with the constructor method.** -### Slides only +- Nested carousels are not supported. You should also be aware that carousels in general can often cause usability and accessibility challenges. -Here's a carousel with slides only. Note the presence of the `.d-block` and `.w-100` on carousel images to prevent browser default image alignment. - -{{< example >}} -<div id="carouselExampleSlidesOnly" class="carousel slide" data-bs-ride="carousel"> - <div class="carousel-inner"> - <div class="carousel-item active"> - {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}} - </div> - <div class="carousel-item"> - {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}} - </div> - <div class="carousel-item"> - {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}} - </div> - </div> -</div> -{{< /example >}} +{{< callout info >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} +{{< /callout >}} -### With controls +## Basic examples -Adding in the previous and next controls. We recommend using `<button>` elements, but you can also use `<a>` elements with `role="button"`. +Here is a basic example of a carousel with three slides. Note the previous/next controls. We recommend using `<button>` elements, but you can also use `<a>` elements with `role="button"`. {{< example >}} -<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel"> +<div id="carouselExample" class="carousel slide"> <div class="carousel-inner"> <div class="carousel-item active"> {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}} @@ -61,23 +37,27 @@ Adding in the previous and next controls. We recommend using `<button>` elements {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}} </div> </div> - <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev"> + <button class="carousel-control-prev" type="button" data-bs-target="#carouselExample" data-bs-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="visually-hidden">Previous</span> </button> - <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next"> + <button class="carousel-control-next" type="button" data-bs-target="#carouselExample" data-bs-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="visually-hidden">Next</span> </button> </div> {{< /example >}} -### With indicators +Carousels don't automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they're not explicitly required. Add and customize as you see fit. + +**You must add the `.active` class to one of the slides**, otherwise the carousel will not be visible. Also be sure to set a unique `id` on the `.carousel` for optional controls, especially if you're using multiple carousels on a single page. Control and indicator elements must have a `data-bs-target` attribute (or `href` for links) that matches the `id` of the `.carousel` element. -You can also add the indicators to the carousel, alongside the controls, too. +### Indicators + +You can add indicators to the carousel, alongside the previous/next controls. The indicators let users jump directly to a particular slide. {{< example >}} -<div id="carouselExampleIndicators" class="carousel slide" data-bs-ride="true"> +<div id="carouselExampleIndicators" class="carousel slide"> <div class="carousel-indicators"> <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button> <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1" aria-label="Slide 2"></button> @@ -105,12 +85,12 @@ You can also add the indicators to the carousel, alongside the controls, too. </div> {{< /example >}} -### With captions +### Captions -Add captions to your slides easily with the `.carousel-caption` element within any `.carousel-item`. They can be easily hidden on smaller viewports, as shown below, with optional [display utilities]({{< docsref "/utilities/display" >}}). We hide them initially with `.d-none` and bring them back on medium-sized devices with `.d-md-block`. +You can add captions to your slides with the `.carousel-caption` element within any `.carousel-item`. They can be easily hidden on smaller viewports, as shown below, with optional [display utilities]({{< docsref "/utilities/display" >}}). We hide them initially with `.d-none` and bring them back on medium-sized devices with `.d-md-block`. {{< example >}} -<div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="false"> +<div id="carouselExampleCaptions" class="carousel slide"> <div class="carousel-indicators"> <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button> <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="1" aria-label="Slide 2"></button> @@ -155,7 +135,7 @@ Add captions to your slides easily with the `.carousel-caption` element within a Add `.carousel-fade` to your carousel to animate slides with a fade transition instead of a slide. Depending on your carousel content (e.g., text only slides), you may want to add `.bg-body` or some custom CSS to the `.carousel-item`s for proper crossfading. {{< example >}} -<div id="carouselExampleFade" class="carousel slide carousel-fade" data-bs-ride="carousel"> +<div id="carouselExampleFade" class="carousel slide carousel-fade"> <div class="carousel-inner"> <div class="carousel-item active"> {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}} @@ -178,6 +158,66 @@ Add `.carousel-fade` to your carousel to animate slides with a fade transition i </div> {{< /example >}} +## Autoplaying carousels + +You can make your carousels autoplay on page load by setting the `ride` option to `carousel`. Autoplaying carousels automatically pause while hovered with the mouse. This behavior can be controlled with the `pause` option. In browsers that support the [Page Visibility API](https://www.w3.org/TR/page-visibility/), the carousel will stop cycling when the webpage is not visible to the user (such as when the browser tab is inactive, or when the browser window is minimized). + +{{< callout info >}} +For accessibility reasons, we recommend avoiding the use of autoplaying carousels. If your page does include an autoplaying carousel, we recommend providing an additional button or control to explicitly pause/stop the carousel. + +See [WCAG 2.1 Success Criterion 2.2.2 Pause, Stop, Hide](https://www.w3.org/TR/WCAG21/#pause-stop-hide). +{{< /callout >}} + +{{< example >}} +<div id="carouselExampleAutoplaying" class="carousel slide" data-bs-ride="carousel"> + <div class="carousel-inner"> + <div class="carousel-item active"> + {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}} + </div> + <div class="carousel-item"> + {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}} + </div> + <div class="carousel-item"> + {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}} + </div> + </div> + <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleAutoplaying" data-bs-slide="prev"> + <span class="carousel-control-prev-icon" aria-hidden="true"></span> + <span class="visually-hidden">Previous</span> + </button> + <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleAutoplaying" data-bs-slide="next"> + <span class="carousel-control-next-icon" aria-hidden="true"></span> + <span class="visually-hidden">Next</span> + </button> +</div> +{{< /example >}} + +When the `ride` option is set to `true`, rather than `carousel`, the carousel won't automatically start to cycle on page load. Instead, it will only start after the first user interaction. + +{{< example >}} +<div id="carouselExampleRide" class="carousel slide" data-bs-ride="true"> + <div class="carousel-inner"> + <div class="carousel-item active"> + {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}} + </div> + <div class="carousel-item"> + {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}} + </div> + <div class="carousel-item"> + {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}} + </div> + </div> + <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleRide" data-bs-slide="prev"> + <span class="carousel-control-prev-icon" aria-hidden="true"></span> + <span class="visually-hidden">Previous</span> + </button> + <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleRide" data-bs-slide="next"> + <span class="carousel-control-next-icon" aria-hidden="true"></span> + <span class="visually-hidden">Next</span> + </button> +</div> +{{< /example >}} + ### Individual `.carousel-item` interval Add `data-bs-interval=""` to a `.carousel-item` to change the amount of time to delay between automatically cycling to the next item. @@ -206,9 +246,29 @@ Add `data-bs-interval=""` to a `.carousel-item` to change the amount of time to </div> {{< /example >}} -### Disable touch swiping +### Autoplaying carousels without controls -Carousels support swiping left/right on touchscreen devices to move between slides. This can be disabled using the `data-bs-touch` attribute. The example below also does not include the `data-bs-ride` attribute so it doesn't autoplay. +Here's a carousel with slides only. Note the presence of the `.d-block` and `.w-100` on carousel images to prevent browser default image alignment. + +{{< example >}} +<div id="carouselExampleSlidesOnly" class="carousel slide" data-bs-ride="carousel"> + <div class="carousel-inner"> + <div class="carousel-item active"> + {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#555" background="#777" text="First slide" >}} + </div> + <div class="carousel-item"> + {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#444" background="#666" text="Second slide" >}} + </div> + <div class="carousel-item"> + {{< placeholder width="800" height="400" class="bd-placeholder-img-lg d-block w-100" color="#333" background="#555" text="Third slide" >}} + </div> + </div> +</div> +{{< /example >}} + +## Disable touch swiping + +Carousels support swiping left/right on touchscreen devices to move between slides. This can be disabled by setting the `touch` option to `false`. {{< example >}} <div id="carouselExampleControlsNoTouching" class="carousel slide" data-bs-touch="false"> @@ -236,10 +296,14 @@ Carousels support swiping left/right on touchscreen devices to move between slid ## Dark variant -Add `.carousel-dark` to the `.carousel` for darker controls, indicators, and captions. Controls have been inverted from their default white fill with the `filter` CSS property. Captions and controls have additional Sass variables that customize the `color` and `background-color`. +{{< deprecated-in "5.3.0" >}} + +Add `.carousel-dark` to the `.carousel` for darker controls, indicators, and captions. Controls are inverted compared to their default white fill with the `filter` CSS property. Captions and controls have additional Sass variables that customize the `color` and `background-color`. + +{{< callout-deprecated-dark-variants "carousel" >}} {{< example >}} -<div id="carouselExampleDark" class="carousel carousel-dark slide" data-bs-ride="carousel"> +<div id="carouselExampleDark" class="carousel carousel-dark slide"> <div class="carousel-indicators"> <button type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button> <button type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="1" aria-label="Slide 2"></button> @@ -283,9 +347,9 @@ Add `.carousel-dark` to the `.carousel` for darker controls, indicators, and cap The transition duration of `.carousel-item` can be changed with the `$carousel-transition-duration` Sass variable before compiling or custom styles if you're using the compiled CSS. If multiple transitions are applied, make sure the transform transition is defined first (e.g. `transition: transform 2s ease, opacity .5s ease-out`). -## Sass +## CSS -### Variables +### Sass variables Variables for all carousels: @@ -301,8 +365,6 @@ Variables for the [dark carousel](#dark-variant): Use data attributes to easily control the position of the carousel. `data-bs-slide` accepts the keywords `prev` or `next`, which alters the slide position relative to its current position. Alternatively, use `data-bs-slide-to` to pass a raw slide index to the carousel `data-bs-slide-to="2"`, which shifts the slide position to a particular index beginning with `0`. -The `data-bs-ride="carousel"` attribute is used to mark a carousel as animating starting at page load. If you don't use `data-bs-ride="carousel"` to initialize your carousel, you have to initialize it yourself. **It cannot be used in combination with (redundant and unnecessary) explicit JavaScript initialization of the same carousel.** - ### Via JavaScript Call carousel manually with: @@ -331,28 +393,29 @@ const carousel = new bootstrap.Carousel('#myCarousel') ### Methods {{< callout danger >}} -{{< partial "callout-danger-async-methods.md" >}} +{{< partial "callouts/danger-async-methods.md" >}} {{< /callout >}} -You can create a carousel instance with the carousel constructor, for example, to initialize with additional options and start cycling through items: +You can create a carousel instance with the carousel constructor, and pass on any additional options. For example, to manually initialize an autoplaying carousel (assuming you're not using the `data-bs-ride="carousel"` attribute in the markup itself) with a specific interval and with touch support disabled, you can use: ```js const myCarouselElement = document.querySelector('#myCarousel') + const carousel = new bootstrap.Carousel(myCarouselElement, { interval: 2000, - wrap: false + touch: false }) ``` {{< bs-table >}} | Method | Description | | --- | --- | -| `cycle` | Cycles through the carousel items from left to right. | +| `cycle` | Starts cycling through the carousel items from left to right. | | `dispose` | Destroys an element's carousel. (Removes stored data on the DOM element) | -| `getInstance` | Static method which allows you to get the carousel instance associated to a DOM element, you can use it like this: `bootstrap.Carousel.getInstance(element)`. | -| `getOrCreateInstance` | Static method which returns a carousel instance associated to a DOM element or create a new one in case it wasn't initialized. You can use it like this: `bootstrap.Carousel.getOrCreateInstance(element)`. | +| `getInstance` | Static method which allows you to get the carousel instance associated to a DOM element. You can use it like this: `bootstrap.Carousel.getInstance(element)`. | +| `getOrCreateInstance` | Static method which returns a carousel instance associated to a DOM element, or creates a new one in case it wasn't initialized. You can use it like this: `bootstrap.Carousel.getOrCreateInstance(element)`. | | `next` | Cycles to the next item. **Returns to the caller before the next item has been shown** (e.g., before the `slid.bs.carousel` event occurs). | -| `nextWhenVisible` | Don't cycle carousel to next when the page isn't visible or the carousel or its parent isn't visible. **Returns to the caller before the target item has been shown**. | +| `nextWhenVisible` | Don't cycle carousel to next when the page, the carousel, or the carousel's parent aren't visible. **Returns to the caller before the target item has been shown**. | | `pause` | Stops the carousel from cycling through items. | | `prev` | Cycles to the previous item. **Returns to the caller before the previous item has been shown** (e.g., before the `slid.bs.carousel` event occurs). | | `to` | Cycles the carousel to a particular frame (0 based, similar to an array). **Returns to the caller before the target item has been shown** (e.g., before the `slid.bs.carousel` event occurs). | diff --git a/site/content/docs/5.2/components/collapse.md b/site/content/docs/5.3/components/collapse.md index 21be901..21b9c3e 100644 --- a/site/content/docs/5.2/components/collapse.md +++ b/site/content/docs/5.3/components/collapse.md @@ -11,7 +11,7 @@ toc: true The collapse JavaScript plugin is used to show and hide content. Buttons or anchors are used as triggers that are mapped to specific elements you toggle. Collapsing an element will animate the `height` from its current value to `0`. Given how CSS handles animations, you cannot use `padding` on a `.collapse` element. Instead, use the class as an independent wrapping element. {{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} {{< /callout >}} ## Example @@ -22,7 +22,7 @@ Click the buttons below to show and hide another element via class changes: - `.collapsing` is applied during transitions - `.collapse.show` shows content -Generally, we recommend using a button with the `data-bs-target` attribute. While not recommended from a semantic point of view, you can also use a link with the `href` attribute (and a `role="button"`). In both cases, the `data-bs-toggle="collapse"` is required. +Generally, we recommend using a `<button>` with the `data-bs-target` attribute. While not recommended from a semantic point of view, you can also use an `<a>` link with the `href` attribute (and a `role="button"`). In both cases, the `data-bs-toggle="collapse"` is required. {{< example >}} <p> @@ -42,7 +42,7 @@ Generally, we recommend using a button with the `data-bs-target` attribute. Whil ## 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" >}}). +The collapse plugin 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.** @@ -63,10 +63,10 @@ Please note that while the example below has a `min-height` set to avoid excessi </div> {{< /example >}} -## Multiple targets +## Multiple toggles and 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. -Multiple `<button>` or `<a>` can show and hide an element if they each reference it with their `href` or `data-bs-target` attribute +A `<button>` or `<a>` element can show and hide multiple elements by referencing them with a selector in its `data-bs-target` or `href` attribute. +Conversely, multiple `<button>` or `<a>` elements can show and hide the same element if they each reference it with their `data-bs-target` or `href` attribute. {{< example >}} <p> @@ -100,9 +100,9 @@ If your control element is targeting a single collapsible element – i.e. the ` Note that Bootstrap's current implementation does not cover the various *optional* keyboard interactions described in the [ARIA Authoring Practices Guide accordion pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/) - you will need to include these yourself with custom JavaScript. -## Sass +## CSS -### Variables +### Sass variables {{< scss-docs name="collapse-transition" file="scss/_variables.scss" >}} @@ -153,7 +153,7 @@ const collapseList = [...collapseElementList].map(collapseEl => new bootstrap.Co ### Methods {{< callout danger >}} -{{< partial "callout-danger-async-methods.md" >}} +{{< partial "callouts/danger-async-methods.md" >}} {{< /callout >}} Activates your content as a collapsible element. Accepts an optional options `object`. diff --git a/site/content/docs/5.2/components/dropdowns.md b/site/content/docs/5.3/components/dropdowns.md index b589227..0988820 100644 --- a/site/content/docs/5.2/components/dropdowns.md +++ b/site/content/docs/5.3/components/dropdowns.md @@ -18,15 +18,15 @@ The [<abbr title="Web Accessibility Initiative">WAI</abbr> <abbr title="Accessib Bootstrap's dropdowns, on the other hand, are designed to be generic and applicable to a variety of situations and markup structures. For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms. For this reason, Bootstrap does not expect (nor automatically add) any of the `role` and `aria-` attributes required for true <abbr title="Accessible Rich Internet Applications">ARIA</abbr> menus. Authors will have to include these more specific attributes themselves. -However, Bootstrap does add built-in support for most standard keyboard menu interactions, such as the ability to move through individual `.dropdown-item` elements using the cursor keys and close the menu with the <kbd>ESC</kbd> key. +However, Bootstrap does add built-in support for most standard keyboard menu interactions, such as the ability to move through individual `.dropdown-item` elements using the cursor keys and close the menu with the <kbd>Esc</kbd> key. ## Examples -Wrap the dropdown's toggle (your button or link) and the dropdown menu within `.dropdown`, or another element that declares `position: relative;`. Dropdowns can be triggered from `<a>` or `<button>` elements to better fit your potential needs. The examples shown here use semantic `<ul>` elements where appropriate, but custom markup is supported. +Wrap the dropdown's toggle (your button or link) and the dropdown menu within `.dropdown`, or another element that declares `position: relative;`. Ideally, you should use a `<button>` element as the dropdown trigger, but the plugin will work with `<a>` elements as well. The examples shown here use semantic `<ul>` elements where appropriate, but custom markup is supported. ### Single button -Any single `.btn` can be turned into a dropdown toggle with some markup changes. Here's how you can put them to work with either `<button>` elements: +Any single `.btn` can be turned into a dropdown toggle with some markup changes. Here's how you can put them to work with `<button>` elements: {{< example >}} <div class="dropdown"> @@ -41,7 +41,7 @@ Any single `.btn` can be turned into a dropdown toggle with some markup changes. </div> {{< /example >}} -And with `<a>` elements: +While `<button>` is the recommended control for a dropdown toggle, there might be situations where you have to use an `<a>` element. If you do, we recommend adding a `role="button"` attribute to appropriately convey control's purpose to assistive technologies such as screen readers. {{< example >}} <div class="dropdown"> @@ -349,8 +349,12 @@ Button dropdowns work with buttons of all sizes, including default and split dro ## Dark dropdowns +{{< deprecated-in "5.3.0" >}} + Opt into darker dropdowns to match a dark navbar or custom style by adding `.dropdown-menu-dark` onto an existing `.dropdown-menu`. No changes are required to the dropdown items. +{{< callout-deprecated-dark-variants "dropdown-menu" >}} + {{< example >}} <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> @@ -378,9 +382,9 @@ And putting it to use in a navbar: <div class="collapse navbar-collapse" id="navbarNavDarkDropdown"> <ul class="navbar-nav"> <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> + <button class="btn btn-dark dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> Dropdown - </a> + </button> <ul class="dropdown-menu dropdown-menu-dark"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> @@ -396,8 +400,7 @@ And putting it to use in a navbar: ## Directions {{< callout info >}} -#### RTL -Directions are mirrored when using Bootstrap in RTL, meaning `.dropstart` will appear on the right side. +**Directions are flipped in RTL mode.** As such, `.dropstart` will appear on the right side. {{< /callout >}} ### Centered @@ -838,7 +841,7 @@ Separate groups of related menu items with a divider. Place any freeform text within a dropdown menu with text and use [spacing utilities]({{< docsref "/utilities/spacing" >}}). Note that you'll likely need additional sizing styles to constrain the menu width. {{< example >}} -<div class="dropdown-menu p-4 text-muted" style="max-width: 200px;"> +<div class="dropdown-menu p-4 text-body-secondary" style="max-width: 200px;"> <p> Some example text that's free-flowing within the dropdown menu. </p> @@ -956,7 +959,7 @@ By default, the dropdown menu is closed when clicking inside or outside the drop <div class="btn-group"> <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="inside" aria-expanded="false"> - Clickable outside + Clickable inside </button> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="#">Menu item</a></li> @@ -967,7 +970,7 @@ By default, the dropdown menu is closed when clicking inside or outside the drop <div class="btn-group"> <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false"> - Clickable inside + Clickable outside </button> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="#">Menu item</a></li> @@ -998,6 +1001,12 @@ As part of Bootstrap's evolving CSS variables approach, dropdowns now use local {{< scss-docs name="dropdown-css-vars" file="scss/_dropdown.scss" >}} +{{< callout info >}} +Dropdown items include at least one variable that is not set on `.dropdown`. This allows you to provide a new value while Bootstrap defaults to a fallback value. + +- `--bs-dropdown-item-border-radius` +{{< /callout >}} + Customization through CSS variables can be seen on the `.dropdown-menu-dark` class where we override specific values without adding duplicate CSS selectors. {{< scss-docs name="dropdown-dark-css-vars" file="scss/_dropdown.scss" >}} @@ -1016,7 +1025,7 @@ Variables for the CSS-based carets that indicate a dropdown's interactivity: {{< scss-docs name="caret-variables" file="scss/_variables.scss" >}} -### Mixins +### Sass mixins Mixins are used to generate the CSS-based carets and can be found in `scss/mixins/_caret.scss`. @@ -1047,6 +1056,10 @@ Add `data-bs-toggle="dropdown"` to a link or button to toggle a dropdown. ### Via JavaScript +{{< callout warning >}} +Dropdowns must have `data-bs-toggle="dropdown"` on their trigger element, regardless of whether you call your dropdown via JavaScript or use the data-api. +{{< /callout >}} + Call the dropdowns via JavaScript: ```js @@ -1054,12 +1067,6 @@ const dropdownElementList = document.querySelectorAll('.dropdown-toggle') const dropdownList = [...dropdownElementList].map(dropdownToggleEl => new bootstrap.Dropdown(dropdownToggleEl)) ``` -{{< callout info >}} -##### `data-bs-toggle="dropdown"` still required - -Regardless of whether you call your dropdown via JavaScript or instead use the data-api, `data-bs-toggle="dropdown"` is always required to be present on the dropdown's trigger element. -{{< /callout >}} - ### Options {{< markdown >}} @@ -1069,7 +1076,7 @@ Regardless of whether you call your dropdown via JavaScript or instead use the d {{< bs-table "table" >}} | Name | Type | Default | Description | | --- | --- | --- | --- | -| `autoClose` | boolean, string | `true` | Configure the auto close behavior of the dropdown: <ul class="my-2"><li>`true` - the dropdown will be closed by clicking outside or inside the dropdown menu.</li><li>`false` - the dropdown will be closed by clicking the toggle button and manually calling `hide` or `toggle` method. (Also will not be closed by pressing <kbd>esc</kbd> key)</li><li>`'inside'` - the dropdown will be closed (only) by clicking inside the dropdown menu.</li> <li>`'outside'` - the dropdown will be closed (only) by clicking outside the dropdown menu.</li></ul> Note: the dropdown can always be closed with the <kbd>ESC</kbd> key. | +| `autoClose` | boolean, string | `true` | Configure the auto close behavior of the dropdown: <ul class="my-2"><li>`true` - the dropdown will be closed by clicking outside or inside the dropdown menu.</li><li>`false` - the dropdown will be closed by clicking the toggle button and manually calling `hide` or `toggle` method. (Also will not be closed by pressing <kbd>Esc</kbd> key)</li><li>`'inside'` - the dropdown will be closed (only) by clicking inside the dropdown menu.</li> <li>`'outside'` - the dropdown will be closed (only) by clicking outside the dropdown menu.</li></ul> Note: the dropdown can always be closed with the <kbd>Esc</kbd> key. | | `boundary` | string, element | `'clippingParents'` | Overflow constraint boundary of the dropdown menu (applies only to Popper's preventOverflow modifier). By default it's `clippingParents` and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper's [detectOverflow docs](https://popper.js.org/docs/v2/utils/detect-overflow/#boundary). | | `display` | string | `'dynamic'` | By default, we use Popper for dynamic positioning. Disable this with `static`. | | `offset` | array, string, function | `[0, 2]` | Offset of the dropdown relative to its target. You can pass a string in data attributes with comma separated values like: `data-bs-offset="10,20"`. When a function is used to determine the offset, it is called with an object containing the popper placement, the reference, and popper rects as its first argument. The triggering element DOM node is passed as the second argument. The function must return an array with two numbers: [skidding](https://popper.js.org/docs/v2/modifiers/offset/#skidding-1), [distance](https://popper.js.org/docs/v2/modifiers/offset/#distance-1). For more information refer to Popper's [offset docs](https://popper.js.org/docs/v2/modifiers/offset/#options). | diff --git a/site/content/docs/5.2/components/list-group.md b/site/content/docs/5.3/components/list-group.md index 7804c74..6c22809 100644 --- a/site/content/docs/5.2/components/list-group.md +++ b/site/content/docs/5.3/components/list-group.md @@ -154,7 +154,11 @@ Add `.list-group-horizontal` to change the layout of list group items from verti {{< /list-group.inline >}} {{< /example >}} -## Contextual classes +## Variants + +{{< callout info >}} +**Heads up!** As of v5.3.0, the `list-group-item-variant()` Sass mixin is deprecated. List group item variants now have their CSS variables overridden in [a Sass loop](#sass-loops). +{{< /callout >}} Use contextual classes to style list items with a stateful background and color. @@ -169,7 +173,9 @@ Use contextual classes to style list items with a stateful background and color. </ul> {{< /example >}} -Contextual classes also work with `.list-group-item-action`. Note the addition of the hover styles here not present in the previous example. Also supported is the `.active` state; apply it to indicate an active selection on a contextual list group item. +### For links and buttons + +Contextual classes also work with `.list-group-item-action` for `<a>` and `<button>` elements. Note the addition of the hover styles here not present in the previous example. Also supported is the `.active` state; apply it to indicate an active selection on a contextual list group item. {{< example >}} <div class="list-group"> @@ -183,7 +189,7 @@ Contextual classes also work with `.list-group-item-action`. Note the addition o {{< /example >}} {{< callout info >}} -{{< partial "callout-warning-color-assistive-technologies.md" >}} +{{< partial "callouts/warning-color-assistive-technologies.md" >}} {{< /callout >}} ## With badges @@ -224,18 +230,18 @@ Add nearly any HTML within, even for linked list groups like the one below, with <a href="#" class="list-group-item list-group-item-action"> <div class="d-flex w-100 justify-content-between"> <h5 class="mb-1">List group item heading</h5> - <small class="text-muted">3 days ago</small> + <small class="text-body-secondary">3 days ago</small> </div> <p class="mb-1">Some placeholder content in a paragraph.</p> - <small class="text-muted">And some muted small print.</small> + <small class="text-body-secondary">And some muted small print.</small> </a> <a href="#" class="list-group-item list-group-item-action"> <div class="d-flex w-100 justify-content-between"> <h5 class="mb-1">List group item heading</h5> - <small class="text-muted">3 days ago</small> + <small class="text-body-secondary">3 days ago</small> </div> <p class="mb-1">Some placeholder content in a paragraph.</p> - <small class="text-muted">And some muted small print.</small> + <small class="text-body-secondary">And some muted small print.</small> </a> </div> {{< /example >}} @@ -311,15 +317,17 @@ As part of Bootstrap's evolving CSS variables approach, list groups now use loca {{< scss-docs name="list-group-variables" file="scss/_variables.scss" >}} -### Mixins +### Sass mixins + +{{< deprecated-in "5.3.0" >}} -Used in combination with `$theme-colors` to generate the [contextual variant classes](#contextual-classes) for `.list-group-item`s. +Used in combination with `$theme-colors` to generate the [contextual variant classes](#variants) for `.list-group-item`s. {{< scss-docs name="list-group-mixin" file="scss/mixins/_list-group.scss" >}} -### Loop +### Sass loops -Loop that generates the modifier classes with the `list-group-item-variant()` mixin. +Loop that generates the modifier classes with an overriding of CSS variables. {{< scss-docs name="list-group-modifiers" file="scss/_list-group.scss" >}} @@ -443,7 +451,7 @@ To make tabs panel fade in, add `.fade` to each `.tab-pane`. The first tab pane ### Methods {{< callout danger >}} -{{< partial "callout-danger-async-methods.md" >}} +{{< partial "callouts/danger-async-methods.md" >}} {{< /callout >}} Activates your content as a tab element. diff --git a/site/content/docs/5.2/components/modal.md b/site/content/docs/5.3/components/modal.md index ed31b73..ba2a51a 100644 --- a/site/content/docs/5.2/components/modal.md +++ b/site/content/docs/5.3/components/modal.md @@ -27,7 +27,7 @@ myModal.addEventListener('shown.bs.modal', () => { ``` {{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} {{< /callout >}} Keep reading for demos and usage guidelines. @@ -38,7 +38,7 @@ Keep reading for demos and usage guidelines. Below is a _static_ modal example (meaning its `position` and `display` have been overridden). Included are the modal header, modal body (required for `padding`), and modal footer (optional). We ask that you include modal headers with dismiss actions whenever possible, or provide another explicit dismiss action. -<div class="bd-example bg-light"> +<div class="bd-example bg-body-tertiary"> <div class="modal position-static d-block" tabindex="-1"> <div class="modal-dialog"> <div class="modal-content"> @@ -202,7 +202,7 @@ When modals become too long for the user's viewport or device, they scroll indep <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body" style="min-height: 1500px"> - <p>This is some placeholder content to show the scrolling behavior for modals. Instead of repeating the text the modal, we use an inline style set a minimum height, thereby extending the length of the overall modal and demonstrating the overflow scrolling. When content becomes longer than the height of the viewport, scrolling will move the modal as needed.</p> + <p>This is some placeholder content to show the scrolling behavior for modals. Instead of repeating the text in the modal, we use an inline style to set a minimum height, thereby extending the length of the overall modal and demonstrating the overflow scrolling. When content becomes longer than the height of the viewport, scrolling will move the modal as needed.</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> @@ -329,7 +329,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal. </div> <div class="modal-body"> <h2 class="fs-5">Popover in a modal</h2> - <p>This <a href="#" role="button" class="btn btn-secondary" data-bs-toggle="popover" title="Popover title" data-bs-content="Popover body content is set in this attribute." data-bs-container="#exampleModalPopovers">button</a> triggers a popover on click.</p> + <p>This <button class="btn btn-secondary" data-bs-toggle="popover" title="Popover title" data-bs-content="Popover body content is set in this attribute." data-bs-container="#exampleModalPopovers">button</button> triggers a popover on click.</p> <hr> <h2 class="fs-5">Tooltips in a modal</h2> <p><a href="#" data-bs-toggle="tooltip" title="Tooltip" data-bs-container="#exampleModalPopovers">This link</a> and <a href="#" data-bs-toggle="tooltip" title="Tooltip" data-bs-container="#exampleModalPopovers">that link</a> have tooltips on hover.</p> @@ -351,7 +351,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal. ```html <div class="modal-body"> <h2 class="fs-5">Popover in a modal</h2> - <p>This <a href="#" role="button" class="btn btn-secondary" data-bs-toggle="popover" title="Popover title" data-bs-content="Popover body content is set in this attribute.">button</a> triggers a popover on click.</p> + <p>This <button class="btn btn-secondary" data-bs-toggle="popover" title="Popover title" data-bs-content="Popover body content is set in this attribute.">button</button> triggers a popover on click.</p> <hr> <h2 class="fs-5">Tooltips in a modal</h2> <p><a href="#" data-bs-toggle="tooltip" title="Tooltip">This link</a> and <a href="#" data-bs-toggle="tooltip" title="Tooltip">that link</a> have tooltips on hover.</p> @@ -481,24 +481,7 @@ Below is a live demo followed by example HTML and JavaScript. For more informati </div> {{< /example >}} -```js -const exampleModal = document.getElementById('exampleModal') -exampleModal.addEventListener('show.bs.modal', event => { - // Button that triggered the modal - const button = event.relatedTarget - // Extract info from data-bs-* attributes - const recipient = button.getAttribute('data-bs-whatever') - // If necessary, you could initiate an AJAX request here - // and then do the updating in a callback. - // - // Update the modal's content. - const modalTitle = exampleModal.querySelector('.modal-title') - const modalBodyInput = exampleModal.querySelector('.modal-body input') - - modalTitle.textContent = `New message to ${recipient}` - modalBodyInput.value = recipient -}) -``` +{{< js-docs name="varying-modal-content" file="site/assets/js/snippets.js" >}} ### Toggle between modals @@ -537,7 +520,7 @@ Toggle between multiple modals with some clever placement of the `data-bs-target </div> </div> </div> -<a class="btn btn-primary" data-bs-toggle="modal" href="#exampleModalToggle" role="button">Open first modal</a> +<button class="btn btn-primary" data-bs-target="#exampleModalToggle" data-bs-toggle="modal">Open first modal</button> {{< /example >}} ### Change animation @@ -576,7 +559,7 @@ Modals have three optional sizes, available via modifier classes to be placed on | Size | Class | Modal max-width | --- | --- | --- | | Small | `.modal-sm` | `300px` | -| Default | <span class="text-muted">None</span> | `500px` | +| Default | <span class="text-body-secondary">None</span> | `500px` | | Large | `.modal-lg` | `800px` | | Extra large | `.modal-xl` | `1140px` | {{< /bs-table >}} @@ -643,7 +626,7 @@ Another override is the option to pop up a modal that covers the user viewport, {{< bs-table >}} | Class | Availability | -| --- | --- | --- | +| --- | --- | | `.modal-fullscreen` | Always | | `.modal-fullscreen-sm-down` | `576px` | | `.modal-fullscreen-md-down` | `768px` | @@ -786,7 +769,7 @@ As part of Bootstrap's evolving CSS variables approach, modals now use local CSS {{< scss-docs name="modal-variables" file="scss/_variables.scss" >}} -### Loop +### Sass loops [Responsive fullscreen modals](#fullscreen-modal) are generated via the `$breakpoints` map and a loop in `scss/_modal.scss`. @@ -841,7 +824,7 @@ const myModalAlternative = new bootstrap.Modal('#myModal', options) ### Methods {{< callout danger >}} -{{< partial "callout-danger-async-methods.md" >}} +{{< partial "callouts/danger-async-methods.md" >}} {{< /callout >}} #### Passing options @@ -858,8 +841,8 @@ const myModal = new bootstrap.Modal('#myModal', { | Method | Description | | --- | --- | | `dispose` | Destroys an element's modal. (Removes stored data on the DOM element) | -| `getInstance` | *Static* method which allows you to get the modal instance associated with a DOM element. | -| `getOrCreateInstance` | *Static* method which allows you to get the modal instance associated with a DOM element, or create a new one in case it wasn't initialized. | +| `getInstance` | _Static_ method which allows you to get the modal instance associated with a DOM element. | +| `getOrCreateInstance` | _Static_ method which allows you to get the modal instance associated with a DOM element, or create a new one in case it wasn't initialized. | | `handleUpdate` | Manually readjust the modal's position if the height of a modal changes while it is open (i.e. in case a scrollbar appears). | | `hide` | Manually hides a modal. **Returns to the caller before the modal has actually been hidden** (i.e. before the `hidden.bs.modal` event occurs). | | `show` | Manually opens a modal. **Returns to the caller before the modal has actually been shown** (i.e. before the `shown.bs.modal` event occurs). Also, you can pass a DOM element as an argument that can be received in the modal events (as the `relatedTarget` property). (i.e. `const modalToggle = document.getElementById('toggleMyModal'); myModal.show(modalToggle)`. | diff --git a/site/content/docs/5.2/components/navbar.md b/site/content/docs/5.3/components/navbar.md index 7cbc4e2..9b9f86a 100644 --- a/site/content/docs/5.2/components/navbar.md +++ b/site/content/docs/5.3/components/navbar.md @@ -19,7 +19,7 @@ Here's what you need to know before getting started with the navbar: - **New in v5.2.0:** Navbars can be themed with CSS variables that are scoped to the `.navbar` base class. `.navbar-light` has been deprecated and `.navbar-dark` has been rewritten to override CSS variables instead of adding additional styles. {{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} {{< /callout >}} ## Supported content @@ -37,7 +37,7 @@ Navbars come with built-in support for a handful of sub-components. Choose from Here's an example of all the sub-components included in a responsive light-themed navbar that automatically collapses at the `lg` (large) breakpoint. {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> @@ -75,7 +75,7 @@ Here's an example of all the sub-components included in a responsive light-theme </nav> {{< /example >}} -This example uses [background]({{< docsref "/utilities/background" >}}) (`bg-light`) and [spacing]({{< docsref "/utilities/spacing" >}}) (`me-auto`, `mb-2`, `mb-lg-0`, `me-2`) utility classes. +This example uses [background]({{< docsref "/utilities/background" >}}) (`bg-body-tertiary`) and [spacing]({{< docsref "/utilities/spacing" >}}) (`me-auto`, `mb-2`, `mb-lg-0`, `me-2`) utility classes. ### Brand @@ -87,14 +87,14 @@ Add your text within an element with the `.navbar-brand` class. {{< example >}} <!-- As a link --> -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> </div> </nav> <!-- As a heading --> -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <div class="container-fluid"> <span class="navbar-brand mb-0 h1">Navbar</span> </div> @@ -106,7 +106,7 @@ Add your text within an element with the `.navbar-brand` class. You can replace the text within the `.navbar-brand` with an `<img>`. {{< example >}} -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <div class="container"> <a class="navbar-brand" href="#"> <img src="/docs/{{< param docs_version >}}/assets/brand/bootstrap-logo.svg" alt="Bootstrap" width="30" height="24"> @@ -120,7 +120,7 @@ You can replace the text within the `.navbar-brand` with an `<img>`. You can also make use of some additional utilities to add an image and text at the same time. Note the addition of `.d-inline-block` and `.align-text-top` on the `<img>`. {{< example >}} -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#"> <img src="/docs/{{< param docs_version >}}/assets/brand/bootstrap-logo.svg" alt="Logo" width="30" height="24" class="d-inline-block align-text-top"> @@ -139,7 +139,7 @@ Add the `.active` class on `.nav-link` to indicate the current page. Please note that you should also add the `aria-current` attribute on the active `.nav-link`. {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> @@ -168,7 +168,7 @@ Please note that you should also add the `aria-current` attribute on the active And because we use classes for our navs, you can avoid the list-based approach entirely if you like. {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> @@ -189,7 +189,7 @@ And because we use classes for our navs, you can avoid the list-based approach e You can also use dropdowns in your navbar. Dropdown menus require a wrapping element for positioning, so be sure to use separate and nested elements for `.nav-item` and `.nav-link` as shown below. {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation"> @@ -227,7 +227,7 @@ You can also use dropdowns in your navbar. Dropdown menus require a wrapping ele Place various form controls and components within a navbar: {{< example >}} -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <div class="container-fluid"> <form class="d-flex" role="search"> <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"> @@ -240,7 +240,7 @@ Place various form controls and components within a navbar: Immediate child elements of `.navbar` use flex layout and will default to `justify-content: space-between`. Use additional [flex utilities]({{< docsref "/utilities/flex" >}}) as needed to adjust this behavior. {{< example >}} -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand">Navbar</a> <form class="d-flex" role="search"> @@ -254,7 +254,7 @@ Immediate child elements of `.navbar` use flex layout and will default to `justi Input groups work, too. If your navbar is an entire form, or mostly a form, you can use the `<form>` element as the container and save some HTML. {{< example >}} -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <form class="container-fluid"> <div class="input-group"> <span class="input-group-text" id="basic-addon1">@</span> @@ -267,7 +267,7 @@ Input groups work, too. If your navbar is an entire form, or mostly a form, you Various buttons are supported as part of these navbar forms, too. This is also a great reminder that vertical alignment utilities can be used to align different sized elements. {{< example >}} -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <form class="container-fluid justify-content-start"> <button class="btn btn-outline-success me-2" type="button">Main button</button> <button class="btn btn-sm btn-outline-secondary" type="button">Smaller button</button> @@ -280,7 +280,7 @@ Various buttons are supported as part of these navbar forms, too. This is also a Navbars may contain bits of text with the help of `.navbar-text`. This class adjusts vertical alignment and horizontal spacing for strings of text. {{< example >}} -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <div class="container-fluid"> <span class="navbar-text"> Navbar text with an inline element @@ -292,7 +292,7 @@ Navbars may contain bits of text with the help of `.navbar-text`. This class adj Mix and match with other components and utilities as needed. {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar w/ text</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation"> @@ -321,13 +321,17 @@ Mix and match with other components and utilities as needed. ## Color schemes {{< callout warning >}} -**New in v5.2.0:** Navbar theming is now powered by CSS variables and `.navbar-light` has been deprecated. CSS variables are applied to `.navbar`, defaulting to the "light" appearance, and can be overridden with `.navbar-dark`. +**New dark navbars in v5.3.0 —** We've deprecated `.navbar-dark` in favor of the new `data-bs-theme="dark"`. Add `data-bs-theme="dark"` to the `.navbar` to enable a component-specific color mode. [Learn more about our color modes.]({{< docsref "/customize/color-modes" >}}) + +--- + +**New in v5.2.0 —** Navbar theming is now powered by CSS variables and `.navbar-light` has been deprecated. CSS variables are applied to `.navbar`, defaulting to the "light" appearance, and can be overridden with `.navbar-dark`. {{< /callout >}} -Navbar themes are easier than ever thanks to Bootstrap's combination of Sass and CSS variables. The default is our "light navbar" for use with light background colors, but you can also apply `.navbar-dark` for dark background colors. Then, customize with `.bg-*` utilities. +Navbar themes are easier than ever thanks to Bootstrap's combination of Sass and CSS variables. The default is our "light navbar" for use with light background colors, but you can also apply `data-bs-theme="dark"` to the `.navbar` parent for dark background colors. Then, customize with `.bg-*` and additional utilities. <div class="bd-example"> - <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> + <nav class="navbar navbar-expand-lg bg-dark border-bottom border-bottom-dark" data-bs-theme="dark"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation"> @@ -356,7 +360,7 @@ Navbar themes are easier than ever thanks to Bootstrap's combination of Sass and </div> </nav> - <nav class="navbar navbar-expand-lg navbar-dark bg-primary"> + <nav class="navbar navbar-expand-lg bg-primary" data-bs-theme="dark"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation"> @@ -385,7 +389,7 @@ Navbar themes are easier than ever thanks to Bootstrap's combination of Sass and </div> </nav> - <nav class="navbar navbar-expand-lg" style="background-color: #e3f2fd;"> + <nav class="navbar navbar-expand-lg" style="background-color: #e3f2fd;" data-bs-theme="light"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor03" aria-controls="navbarColor03" aria-expanded="false" aria-label="Toggle navigation"> @@ -416,11 +420,11 @@ Navbar themes are easier than ever thanks to Bootstrap's combination of Sass and </div> ```html -<nav class="navbar navbar-dark bg-dark"> +<nav class="navbar bg-dark border-bottom border-bottom-dark" data-bs-theme="dark"> <!-- Navbar content --> </nav> -<nav class="navbar navbar-dark bg-primary"> +<nav class="navbar bg-primary" data-bs-theme="dark"> <!-- Navbar content --> </nav> @@ -435,7 +439,7 @@ Although it's not required, you can wrap a navbar in a `.container` to center it {{< example >}} <div class="container"> - <nav class="navbar navbar-expand-lg bg-light"> + <nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> </div> @@ -446,7 +450,7 @@ Although it's not required, you can wrap a navbar in a `.container` to center it Use any of the responsive containers to change how wide the content in your navbar is presented. {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-md"> <a class="navbar-brand" href="#">Navbar</a> </div> @@ -460,7 +464,7 @@ Use our [position utilities]({{< docsref "/utilities/position" >}}) to place nav Fixed navbars use `position: fixed`, meaning they're pulled from the normal flow of the DOM and may require custom CSS (e.g., `padding-top` on the `<body>`) to prevent overlap with other elements. {{< example >}} -<nav class="navbar bg-light"> +<nav class="navbar bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Default</a> </div> @@ -468,7 +472,7 @@ Fixed navbars use `position: fixed`, meaning they're pulled from the normal flow {{< /example >}} {{< example >}} -<nav class="navbar fixed-top bg-light"> +<nav class="navbar fixed-top bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Fixed top</a> </div> @@ -476,7 +480,7 @@ Fixed navbars use `position: fixed`, meaning they're pulled from the normal flow {{< /example >}} {{< example >}} -<nav class="navbar fixed-bottom bg-light"> +<nav class="navbar fixed-bottom bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Fixed bottom</a> </div> @@ -484,7 +488,7 @@ Fixed navbars use `position: fixed`, meaning they're pulled from the normal flow {{< /example >}} {{< example >}} -<nav class="navbar sticky-top bg-light"> +<nav class="navbar sticky-top bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Sticky top</a> </div> @@ -492,7 +496,7 @@ Fixed navbars use `position: fixed`, meaning they're pulled from the normal flow {{< /example >}} {{< example >}} -<nav class="navbar sticky-bottom bg-light"> +<nav class="navbar sticky-bottom bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Sticky bottom</a> </div> @@ -508,7 +512,7 @@ Please note that this behavior comes with a potential drawback of `overflow`—w Here's an example navbar using `.navbar-nav-scroll` with `style="--bs-scroll-height: 100px;"`, with some extra margin utilities for optimum spacing. {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar scroll</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation"> @@ -559,7 +563,7 @@ Navbar togglers are left-aligned by default, but should they follow a sibling el With no `.navbar-brand` shown at the smallest breakpoint: {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> @@ -589,7 +593,7 @@ With no `.navbar-brand` shown at the smallest breakpoint: With a brand name shown on the left and toggler on the right: {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation"> @@ -619,7 +623,7 @@ With a brand name shown on the left and toggler on the right: With a toggler on the left and brand name on the right: {{< example >}} -<nav class="navbar navbar-expand-lg bg-light"> +<nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> @@ -651,10 +655,10 @@ With a toggler on the left and brand name on the right: Sometimes you want to use the collapse plugin to trigger a container element for content that structurally sits outside of the `.navbar` . Because our plugin works on the `id` and `data-bs-target` matching, that's easily done! {{< example >}} -<div class="collapse" id="navbarToggleExternalContent"> +<div class="collapse" id="navbarToggleExternalContent" data-bs-theme="dark"> <div class="bg-dark p-4"> - <h5 class="text-white h4">Collapsed content</h5> - <span class="text-muted">Toggleable via the navbar brand.</span> + <h5 class="text-body-emphasis h4">Collapsed content</h5> + <span class="text-body-secondary">Toggleable via the navbar brand.</span> </div> </div> <nav class="navbar navbar-dark bg-dark"> @@ -675,10 +679,10 @@ Transform your expanding and collapsing navbar into an offcanvas drawer with the In the example below, to create an offcanvas navbar that is always collapsed across all breakpoints, omit the `.navbar-expand-*` class entirely. {{< example >}} -<nav class="navbar bg-light fixed-top"> +<nav class="navbar bg-body-tertiary fixed-top"> <div class="container-fluid"> <a class="navbar-brand" href="#">Offcanvas navbar</a> - <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar" aria-controls="offcanvasNavbar"> + <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar" aria-controls="offcanvasNavbar" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel"> @@ -721,9 +725,9 @@ In the example below, to create an offcanvas navbar that is always collapsed acr To create an offcanvas navbar that expands into a normal navbar at a specific breakpoint like `lg`, use `.navbar-expand-lg`. ```html -<nav class="navbar navbar-expand-lg bg-light fixed-top"> +<nav class="navbar navbar-expand-lg bg-body-tertiary fixed-top"> <a class="navbar-brand" href="#">Offcanvas navbar</a> - <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#navbarOffcanvasLg" aria-controls="navbarOffcanvasLg"> + <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#navbarOffcanvasLg" aria-controls="navbarOffcanvasLg" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="offcanvas offcanvas-end" tabindex="-1" id="navbarOffcanvasLg" aria-labelledby="navbarOffcanvasLgLabel"> @@ -738,7 +742,7 @@ When using offcanvas in a dark navbar, be aware that you may need to have a dark <nav class="navbar navbar-dark bg-dark fixed-top"> <div class="container-fluid"> <a class="navbar-brand" href="#">Offcanvas dark navbar</a> - <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasDarkNavbar" aria-controls="offcanvasDarkNavbar"> + <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasDarkNavbar" aria-controls="offcanvasDarkNavbar" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="offcanvasDarkNavbar" aria-labelledby="offcanvasDarkNavbarLabel"> @@ -806,7 +810,7 @@ Variables for the [dark navbar](#color-schemes): {{< scss-docs name="navbar-dark-variables" file="scss/_variables.scss" >}} -### Sass loop +### Sass loops [Responsive navbar expand/collapse classes](#responsive-behaviors) (e.g., `.navbar-expand-lg`) are combined with the `$breakpoints` map and generated through a loop in `scss/_navbar.scss`. diff --git a/site/content/docs/5.2/components/navs-tabs.md b/site/content/docs/5.3/components/navs-tabs.md index 1748dd1..3242506 100644 --- a/site/content/docs/5.2/components/navs-tabs.md +++ b/site/content/docs/5.3/components/navs-tabs.md @@ -3,7 +3,7 @@ layout: docs title: Navs and tabs description: Documentation and examples for how to use Bootstrap's included navigation components. group: components -aliases: "/docs/5.2/components/navs/" +aliases: "/docs/5.3/components/navs/" toc: true --- @@ -167,6 +167,27 @@ Take that same HTML, but use `.nav-pills` instead: </ul> {{< /example >}} +### Underline + +Take that same HTML, but use `.nav-underline` instead: + +{{< example >}} +<ul class="nav nav-underline"> + <li class="nav-item"> + <a class="nav-link active" aria-current="page" href="#">Active</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled">Disabled</a> + </li> +</ul> +{{< /example >}} + ### Fill and justify Force your `.nav`'s contents to extend the full available width one of two modifier classes. To proportionately fill all available space with your `.nav-item`s, use `.nav-fill`. Notice that all horizontal space is occupied, but not every nav item has the same width. @@ -324,6 +345,12 @@ On the `.nav-pills` modifier class: {{< scss-docs name="nav-pills-css-vars" file="scss/_nav.scss" >}} +{{< added-in "5.3.0" >}} + +On the `.nav-underline` modifier class: + +{{< scss-docs name="nav-underline-css-vars" file="scss/_nav.scss" >}} + ### Sass variables {{< scss-docs name="nav-variables" file="scss/_variables.scss" >}} @@ -622,7 +649,7 @@ To make tabs fade in, add `.fade` to each `.tab-pane`. The first tab pane must a ### Methods {{< callout danger >}} -{{< partial "callout-danger-async-methods.md" >}} +{{< partial "callouts/danger-async-methods.md" >}} {{< /callout >}} Activates your content as a tab element. diff --git a/site/content/docs/5.2/components/offcanvas.md b/site/content/docs/5.3/components/offcanvas.md index c4290ad..7c4c862 100644 --- a/site/content/docs/5.2/components/offcanvas.md +++ b/site/content/docs/5.3/components/offcanvas.md @@ -11,14 +11,14 @@ toc: true Offcanvas is a sidebar component that can be toggled via JavaScript to appear from the left, right, top, or bottom edge of the viewport. Buttons or anchors are used as triggers that are attached to specific elements you toggle, and `data` attributes are used to invoke our JavaScript. - Offcanvas shares some of the same JavaScript code as modals. Conceptually, they are quite similar, but they are separate plugins. -- Similarly, some [source Sass](#sass) variables for offcanvas's styles and dimensions are inherited from the modal's variables. +- Similarly, some [source Sass](#sass-variables) variables for offcanvas's styles and dimensions are inherited from the modal's variables. - When shown, offcanvas includes a default backdrop that can be clicked to hide the offcanvas. - Similar to modals, only one offcanvas can be shown at a time. **Heads up!** Given how CSS handles animations, you cannot use `margin` or `translate` on an `.offcanvas` element. Instead, use the class as an independent wrapping element. {{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} {{< /callout >}} ## Examples @@ -27,7 +27,7 @@ Offcanvas is a sidebar component that can be toggled via JavaScript to appear fr Below is an offcanvas example that is shown by default (via `.show` on `.offcanvas`). Offcanvas includes support for a header with a close button and an optional body class for some initial `padding`. We suggest that you include offcanvas headers with dismiss actions whenever possible, or provide an explicit dismiss action. -{{< example class="bd-example-offcanvas p-0 bg-light overflow-hidden" >}} +{{< example class="bd-example-offcanvas p-0 bg-body-tertiary overflow-hidden" >}} <div class="offcanvas offcanvas-start show" tabindex="-1" id="offcanvas" aria-labelledby="offcanvasLabel"> <div class="offcanvas-header"> <h5 class="offcanvas-title" id="offcanvasLabel">Offcanvas</h5> @@ -139,11 +139,15 @@ When backdrop is set to static, the offcanvas will not close when clicking outsi ## Dark offcanvas -{{< added-in "5.2.0" >}} +{{< deprecated-in "5.3.0" >}} {{< added-in "5.2.0" >}} Change the appearance of offcanvases with utilities to better match them to different contexts like dark navbars. Here we add `.text-bg-dark` to the `.offcanvas` and `.btn-close-white` to `.btn-close` for proper styling with a dark offcanvas. If you have dropdowns within, consider also adding `.dropdown-menu-dark` to `.dropdown-menu`. -{{< example class="bd-example-offcanvas p-0 bg-light overflow-hidden" >}} +{{< callout warning >}} +Heads up! Dark variants for components were deprecated in v5.3.0 with the introduction of color modes. Instead of manually adding classes mentioned above, set `data-bs-theme="dark"` on the root element, a parent wrapper, or the component itself. +{{< /callout >}} + +{{< example class="bd-example-offcanvas p-0 bg-body-secondary overflow-hidden" >}} <div class="offcanvas offcanvas-start show text-bg-dark" tabindex="-1" id="offcanvasDark" aria-labelledby="offcanvasDarkLabel"> <div class="offcanvas-header"> <h5 class="offcanvas-title" id="offcanvasDarkLabel">Offcanvas</h5> @@ -310,7 +314,7 @@ const offcanvasList = [...offcanvasElementList].map(offcanvasEl => new bootstrap ### Methods {{< callout danger >}} -{{< partial "callout-danger-async-methods.md" >}} +{{< partial "callouts/danger-async-methods.md" >}} {{< /callout >}} Activates your content as an offcanvas element. Accepts an optional options `object`. diff --git a/site/content/docs/5.2/components/pagination.md b/site/content/docs/5.3/components/pagination.md index 7251405..7251405 100644 --- a/site/content/docs/5.2/components/pagination.md +++ b/site/content/docs/5.3/components/pagination.md diff --git a/site/content/docs/5.2/components/placeholders.md b/site/content/docs/5.3/components/placeholders.md index 4de4057..3dca347 100644 --- a/site/content/docs/5.2/components/placeholders.md +++ b/site/content/docs/5.3/components/placeholders.md @@ -38,7 +38,7 @@ In the example below, we take a typical card component and recreate it with plac <span class="placeholder col-6"></span> <span class="placeholder col-8"></span> </p> - <a href="#" tabindex="-1" class="btn btn-primary disabled placeholder col-6"></a> + <a class="btn btn-primary disabled placeholder col-6"></a> </div> </div> </div> @@ -67,7 +67,7 @@ In the example below, we take a typical card component and recreate it with plac <span class="placeholder col-6"></span> <span class="placeholder col-8"></span> </p> - <a href="#" tabindex="-1" class="btn btn-primary disabled placeholder col-6"></a> + <a class="btn btn-primary disabled placeholder col-6"></a> </div> </div> ``` @@ -83,7 +83,7 @@ We apply additional styling to `.btn`s via `::before` to ensure the `height` is <span class="placeholder col-6"></span> </p> -<a href="#" tabindex="-1" class="btn btn-primary disabled placeholder col-4" aria-hidden="true"></a> +<a class="btn btn-primary disabled placeholder col-4"></a> {{< /example >}} {{< callout info >}} @@ -126,7 +126,7 @@ The size of `.placeholder`s are based on the typographic style of the parent ele ### Animation -Animate placeholders with `.placeholder-glow` or `.placeholder-wave` to better convey the perception of something being _actively_ loaded. +Animate placeholders with `.placeholder-glow` or `.placeholder-wave` to better convey the perception of something being *actively* loaded. {{< example >}} <p class="placeholder-glow"> @@ -138,8 +138,8 @@ Animate placeholders with `.placeholder-glow` or `.placeholder-wave` to better c </p> {{< /example >}} -## Sass +## CSS -### Variables +### Sass variables {{< scss-docs name="placeholders" file="scss/_variables.scss" >}} diff --git a/site/content/docs/5.2/components/popovers.md b/site/content/docs/5.3/components/popovers.md index 9726c30..0a2138d 100644 --- a/site/content/docs/5.2/components/popovers.md +++ b/site/content/docs/5.3/components/popovers.md @@ -22,11 +22,11 @@ Things to know when using the popover plugin: - Popovers can be triggered thanks to an element inside a shadow DOM. {{< callout info >}} -{{< partial "callout-info-sanitizer.md" >}} +{{< partial "callouts/info-sanitizer.md" >}} {{< /callout >}} {{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} {{< /callout >}} Keep reading to see how popovers work with some examples. @@ -47,7 +47,7 @@ const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstra We use JavaScript similar to the snippet above to render the following live popover. Titles are set via `data-bs-title` and body content is set via `data-bs-content`. {{< callout warning >}} -{{< partial "callout-warning-data-bs-title-vs-title.md" >}} +{{< partial "callouts/warning-data-bs-title-vs-title.md" >}} {{< /callout >}} {{< example stackblitz_add_js="true" >}} @@ -111,12 +111,10 @@ You can customize the appearance of popovers using [CSS variables](#variables). ### Dismiss on next click -Use the `focus` trigger to dismiss popovers on the user's next click of a different element than the toggle element. +Use the `focus` trigger to dismiss popovers on the user's next click of an element other than the toggle element. {{< callout danger >}} -#### Specific markup required for dismiss-on-next-click - -For proper cross-browser and cross-platform behavior, you must use the `<a>` tag, _not_ the `<button>` tag, and you also must include a [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) attribute. +**Dismissing on next click requires specific HTML for proper cross-browser and cross-platform behavior.** You can only use `<a>` elements, not `<button>`s, and you must include a [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex). {{< /callout >}} {{< example stackblitz_add_js="true" >}} @@ -165,13 +163,11 @@ const popover = new bootstrap.Popover(exampleEl, options) ``` {{< callout warning >}} -### Making popovers work for keyboard and assistive technology users - -To allow keyboard users to activate your popovers, you should only add them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as `<span>`s) can be made focusable by adding the `tabindex="0"` attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce the popover's content in this situation. Additionally, do not rely solely on `hover` as the trigger for your popovers, as this will make them impossible to trigger for keyboard users. +**Keep popovers accessible to keyboard and assistive technology users** by only adding them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). While other HTML elements can be made focusable by adding `tabindex="0"`, this can create annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce popovers in this situation. Additionally, do not rely solely on `hover` as the trigger for your popovers as this will make them impossible to trigger for keyboard users. -While you can insert rich, structured HTML in popovers with the `html` option, we strongly recommend that you avoid adding an excessive amount of content. The way popovers currently work is that, once displayed, their content is tied to the trigger element with the `aria-describedby` attribute. As a result, the entirety of the popover's content will be announced to assistive technology users as one long, uninterrupted stream. +Avoid adding an excessive amount of content in popovers with the `html` option. Once popovers are displayed, their content is tied to the trigger element with the `aria-describedby` attribute, causing all of the popover's content to be announced to assistive technology users as one long, uninterrupted stream. -Additionally, while it is possible to also include interactive controls (such as form elements or links) in your popover (by adding these elements to the `allowList` of allowed attributes and tags), be aware that currently the popover does not manage keyboard focus order. When a keyboard user opens a popover, focus remains on the triggering element, and as the popover usually does not immediately follow the trigger in the document's structure, there is no guarantee that moving forward/pressing <kbd>TAB</kbd> will move a keyboard user into the popover itself. In short, simply adding interactive controls to a popover is likely to make these controls unreachable/unusable for keyboard users and users of assistive technologies, or at the very least make for an illogical overall focus order. In these cases, consider using a modal dialog instead. +Popovers do not manage keyboard focus order, and their placement can be random in the DOM, so be careful when adding interactive elements (like forms or links), as it may lead to an illogical focus order or make the popover content itself completely unreachable for keyboard users. In cases where you must use these elements, consider using a modal dialog instead. {{< /callout >}} ### Options @@ -191,7 +187,7 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt | `animation` | boolean | `true` | Apply a CSS fade transition to the popover. | | `boundary` | string, element | `'clippingParents'` | Overflow constraint boundary of the popover (applies only to Popper's preventOverflow modifier). By default, it's `'clippingParents'` and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper's [detectOverflow docs](https://popper.js.org/docs/v2/utils/detect-overflow/#boundary). | | `container` | string, element, false | `false` | Appends the popover to a specific element. Example: `container: 'body'`. This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize. | -| `content` | string, element, function | `''` | Default content value if `data-bs-content` attribute isn't present. If a function is given, it will be called with its `this` reference set to the element that the popover is attached to. | +| `content` | string, element, function | `''` | The popover's text content. If a function is given, it will be called with its `this` reference set to the element that the popover is attached to. | | `customClass` | string, function | `''` | Add classes to the popover when it is shown. Note that these classes will be added in addition to any classes specified in the template. To add multiple classes, separate them with spaces: `'class-1 class-2'`. You can also pass a function that should return a single string containing additional class names. | | `delay` | number, object | `0` | Delay showing and hiding the popover (ms)—doesn't apply to manual trigger type. If a number is supplied, delay is applied to both hide/show. Object structure is: `delay: { "show": 500, "hide": 100 }`. | | `fallbackPlacements` | string, array | `['top', 'right', 'bottom', 'left']` | Define fallback placements by providing a list of placements in array (in order of preference). For more information refer to Popper's [behavior docs](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements). | @@ -203,7 +199,7 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt | `sanitizeFn` | null, function | `null` | Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization. | | `selector` | string, false | `false` | If a selector is provided, popover objects will be delegated to the specified targets. In practice, this is used to also apply popovers to dynamically added DOM elements (`jQuery.on` support). See [this issue]({{< param repo >}}/issues/4215) and [an informative example](https://codepen.io/Johann-S/pen/djJYPb). **Note**: `title` attribute must not be used as a selector. | | `template` | string | `'<div class="popover" role="popover"><div class="popover-arrow"></div><div class="popover-inner"></div></div>'` | Base HTML to use when creating the popover. The popover's `title` will be injected into the `.popover-inner`. `.popover-arrow` will become the popover's arrow. The outermost wrapper element should have the `.popover` class and `role="popover"`. | -| `title` | string, element, function | `''` | Default title value if `title` attribute isn't present. If a function is given, it will be called with its `this` reference set to the element that the popover is attached to. | +| `title` | string, element, function | `''` | The popover title. If a function is given, it will be called with its `this` reference set to the element that the popover is attached to. | | `trigger` | string | `'hover focus'` | How popover is triggered: click, hover, focus, manual. You may pass multiple triggers; separate them with a space. `'manual'` indicates that the popover will be triggered programmatically via the `.popover('show')`, `.popover('hide')` and `.popover('toggle')` methods; this value cannot be combined with any other trigger. `'hover'` on its own will result in popovers that cannot be triggered via the keyboard, and should only be used if alternative methods for conveying the same information for keyboard users is present. | {{< /bs-table >}} @@ -228,7 +224,7 @@ const popover = new bootstrap.Popover(element, { ### Methods {{< callout danger >}} -{{< partial "callout-danger-async-methods.md" >}} +{{< partial "callouts/danger-async-methods.md" >}} {{< /callout >}} {{< bs-table "table" >}} @@ -238,7 +234,7 @@ const popover = new bootstrap.Popover(element, { | `dispose` | Hides and destroys an element's popover (Removes stored data on the DOM element). Popovers that use delegation (which are created using [the `selector` option](#options)) cannot be individually destroyed on descendant trigger elements. | | `enable` | Gives an element's popover the ability to be shown. **Popovers are enabled by default.** | | `getInstance` | _Static_ method which allows you to get the popover instance associated with a DOM element. | -| `getOrCreateInstance` | *Static* method which allows you to get the popover instance associated with a DOM element, or create a new one in case it wasn't initialized. | +| `getOrCreateInstance` | _Static_ method which allows you to get the popover instance associated with a DOM element, or create a new one in case it wasn't initialized. | | `hide` | Hides an element's popover. **Returns to the caller before the popover has actually been hidden** (i.e. before the `hidden.bs.popover` event occurs). This is considered a "manual" triggering of the popover. | | `setContent` | Gives a way to change the popover's content after its initialization. | | `show` | Reveals an element's popover. **Returns to the caller before the popover has actually been shown** (i.e. before the `shown.bs.popover` event occurs). This is considered a "manual" triggering of the popover. Popovers whose title and content are both zero-length are never displayed. | diff --git a/site/content/docs/5.2/components/scrollspy.md b/site/content/docs/5.3/components/scrollspy.md index 53e3fa0..d1abf75 100644 --- a/site/content/docs/5.2/components/scrollspy.md +++ b/site/content/docs/5.3/components/scrollspy.md @@ -12,7 +12,7 @@ Scrollspy toggles the `.active` class on anchor (`<a>`) elements when the elemen - To start, scrollspy requires two things: a navigation, list group, or a simple set of links, plus a scrollable container. The scrollable container can be the `<body>` or a custom element with a set `height` and `overflow-y: scroll`. -- On the scrollable container, add `data-bs-spy="scroll"` and `data-bs-target="#navId"` where `navId` is the unique `id` of the associated navigation. Be sure to also include a `tabindex="0"` to ensure keyboard access. +- On the scrollable container, add `data-bs-spy="scroll"` and `data-bs-target="#navId"` where `navId` is the unique `id` of the associated navigation. If there is no focusable element inside the element, be sure to also include a `tabindex="0"` to ensure keyboard access. - As you scroll the "spied" container, an `.active` class is added and removed from anchor links within the associated navigation. Links must have resolvable `id` targets, otherwise they're ignored. For example, a `<a href="#home">home</a>` must correspond to something in the DOM like `<div id="home"></div>` @@ -25,7 +25,7 @@ Scrollspy toggles the `.active` class on anchor (`<a>`) elements when the elemen Scroll the area below the navbar and watch the active class change. Open the dropdown menu and watch the dropdown items be highlighted as well. <div class="bd-example"> - <nav id="navbar-example2" class="navbar bg-light px-3 mb-3"> + <nav id="navbar-example2" class="navbar bg-body-tertiary px-3 mb-3 rounded-2"> <a class="navbar-brand" href="#">Navbar</a> <ul class="nav nav-pills"> <li class="nav-item"> @@ -45,7 +45,7 @@ Scroll the area below the navbar and watch the active class change. Open the dro </li> </ul> </nav> - <div class="scrollspy-example bg-light p-3 rounded-2" data-bs-spy="scroll" data-bs-target="#navbar-example2" data-bs-root-margin="0px 0px -40%" data-bs-smooth-scroll="true" tabindex="0"> + <div class="scrollspy-example bg-body-tertiary p-3 rounded-2" data-bs-spy="scroll" data-bs-target="#navbar-example2" data-bs-root-margin="0px 0px -40%" data-bs-smooth-scroll="true" tabindex="0"> <h4 id="scrollspyHeading1">First heading</h4> <p>This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.</p> <h4 id="scrollspyHeading2">Second heading</h4> @@ -60,7 +60,7 @@ Scroll the area below the navbar and watch the active class change. Open the dro </div> ```html -<nav id="navbar-example2" class="navbar bg-light px-3 mb-3"> +<nav id="navbar-example2" class="navbar bg-body-tertiary px-3 mb-3"> <a class="navbar-brand" href="#">Navbar</a> <ul class="nav nav-pills"> <li class="nav-item"> @@ -80,7 +80,7 @@ Scroll the area below the navbar and watch the active class change. Open the dro </li> </ul> </nav> -<div data-bs-spy="scroll" data-bs-target="#navbar-example2" data-bs-root-margin="0px 0px -40%" data-bs-smooth-scroll="true" class="scrollspy-example bg-light p-3 rounded-2" tabindex="0"> +<div data-bs-spy="scroll" data-bs-target="#navbar-example2" data-bs-root-margin="0px 0px -40%" data-bs-smooth-scroll="true" class="scrollspy-example bg-body-tertiary p-3 rounded-2" tabindex="0"> <h4 id="scrollspyHeading1">First heading</h4> <p>...</p> <h4 id="scrollspyHeading2">Second heading</h4> diff --git a/site/content/docs/5.2/components/spinners.md b/site/content/docs/5.3/components/spinners.md index bc1b1e6..f2635c6 100644 --- a/site/content/docs/5.2/components/spinners.md +++ b/site/content/docs/5.3/components/spinners.md @@ -13,7 +13,7 @@ Bootstrap "spinners" can be used to show the loading state in your projects. The For accessibility purposes, each loader here includes `role="status"` and a nested `<span class="visually-hidden">Loading...</span>`. {{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} {{< /callout >}} ## Border spinner @@ -205,9 +205,7 @@ Used for creating the CSS animations for our spinners. Included in `scss/_spinne [color]: {{< docsref "/utilities/colors" >}} -[display]: {{< docsref "/utilities/display" >}} [flex]: {{< docsref "/utilities/flex" >}} [float]: {{< docsref "/utilities/float" >}} [margin]: {{< docsref "/utilities/spacing" >}} -[sizing]: {{< docsref "/utilities/sizing" >}} [text]: {{< docsref "/utilities/text" >}} diff --git a/site/content/docs/5.2/components/toasts.md b/site/content/docs/5.3/components/toasts.md index abcb392..a7d1cb7 100644 --- a/site/content/docs/5.2/components/toasts.md +++ b/site/content/docs/5.3/components/toasts.md @@ -16,7 +16,7 @@ Things to know when using the toast plugin: - Toasts will automatically hide if you do not specify `autohide: false`. {{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} {{< /callout >}} ## Examples @@ -27,7 +27,7 @@ To encourage extensible and predictable toasts, we recommend a header and body. Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element to contain your "toasted" content and strongly encourage a dismiss button. -{{< example class="bg-light" >}} +{{< example >}} <div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-header"> {{< placeholder width="20" height="20" background="#007aff" class="rounded me-2" text="false" title="false" >}} @@ -87,17 +87,7 @@ Click the button below to show a toast (positioned with our utilities in the low We use the following JavaScript to trigger our live toast demo: -```js -const toastTrigger = document.getElementById('liveToastBtn') -const toastLiveExample = document.getElementById('liveToast') -if (toastTrigger) { - toastTrigger.addEventListener('click', () => { - const toast = new bootstrap.Toast(toastLiveExample) - - toast.show() - }) -} -``` +{{< js-docs name="live-toast" file="site/assets/js/snippets.js" >}} ### Translucent @@ -108,7 +98,7 @@ Toasts are slightly translucent to blend in with what's below them. <div class="toast-header"> {{< placeholder width="20" height="20" background="#007aff" class="rounded me-2" text="false" title="false" >}} <strong class="me-auto">Bootstrap</strong> - <small class="text-muted">11 mins ago</small> + <small class="text-body-secondary">11 mins ago</small> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> </div> <div class="toast-body"> @@ -121,13 +111,13 @@ Toasts are slightly translucent to blend in with what's below them. You can stack toasts by wrapping them in a toast container, which will vertically add some spacing. -{{< example class="bg-light" >}} +{{< example >}} <div class="toast-container position-static"> <div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-header"> {{< placeholder width="20" height="20" background="#007aff" class="rounded me-2" text="false" title="false" >}} <strong class="me-auto">Bootstrap</strong> - <small class="text-muted">just now</small> + <small class="text-body-secondary">just now</small> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> </div> <div class="toast-body"> @@ -139,7 +129,7 @@ You can stack toasts by wrapping them in a toast container, which will verticall <div class="toast-header"> {{< placeholder width="20" height="20" background="#007aff" class="rounded me-2" text="false" title="false" >}} <strong class="me-auto">Bootstrap</strong> - <small class="text-muted">2 seconds ago</small> + <small class="text-body-secondary">2 seconds ago</small> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> </div> <div class="toast-body"> @@ -153,7 +143,7 @@ You can stack toasts by wrapping them in a toast container, which will verticall Customize your toasts by removing sub-components, tweaking them with [utilities]({{< docsref "/utilities/api" >}}), or by adding your own markup. Here we've created a simpler toast by removing the default `.toast-header`, adding a custom hide icon from [Bootstrap Icons]({{< param icons >}}), and using some [flexbox utilities]({{< docsref "/utilities/flex" >}}) to adjust the layout. -{{< example class="bg-light" >}} +{{< example >}} <div class="toast align-items-center" role="alert" aria-live="assertive" aria-atomic="true"> <div class="d-flex"> <div class="toast-body"> @@ -166,7 +156,7 @@ Customize your toasts by removing sub-components, tweaking them with [utilities] Alternatively, you can also add additional controls and components to toasts. -{{< example class="bg-light" >}} +{{< example >}} <div class="toast" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-body"> Hello, world! This is a toast message. @@ -182,7 +172,7 @@ Alternatively, you can also add additional controls and components to toasts. Building on the above example, you can create different toast color schemes with our [color]({{< docsref "/utilities/colors" >}}) and [background]({{< docsref "/utilities/background" >}}) utilities. Here we've added `.text-bg-primary` to the `.toast`, and then added `.btn-close-white` to our close button. For a crisp edge, we remove the default border with `.border-0`. -{{< example class="bg-light" >}} +{{< example >}} <div class="toast align-items-center text-bg-primary border-0" role="alert" aria-live="assertive" aria-atomic="true"> <div class="d-flex"> <div class="toast-body"> @@ -215,7 +205,7 @@ Place toasts with custom CSS as you need them. The top right is often used for n </select> </div> </form> -<div aria-live="polite" aria-atomic="true" class="bg-dark position-relative bd-example-toasts"> +<div aria-live="polite" aria-atomic="true" class="bg-body-secondary position-relative bd-example-toasts rounded-3"> <div class="toast-container p-3" id="toastPlacement"> <div class="toast"> <div class="toast-header"> @@ -233,7 +223,7 @@ Place toasts with custom CSS as you need them. The top right is often used for n For systems that generate more notifications, consider using a wrapping element so they can easily stack. -{{< example class="bg-dark bd-example-toasts p-0" >}} +{{< example class="bd-example-toasts p-0" >}} <div aria-live="polite" aria-atomic="true" class="position-relative"> <!-- Position it: --> <!-- - `.toast-container` for spacing between toasts --> @@ -246,7 +236,7 @@ For systems that generate more notifications, consider using a wrapping element <div class="toast-header"> {{< placeholder width="20" height="20" background="#007aff" class="rounded me-2" text="false" title="false" >}} <strong class="me-auto">Bootstrap</strong> - <small class="text-muted">just now</small> + <small class="text-body-secondary">just now</small> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> </div> <div class="toast-body"> @@ -258,7 +248,7 @@ For systems that generate more notifications, consider using a wrapping element <div class="toast-header"> {{< placeholder width="20" height="20" background="#007aff" class="rounded me-2" text="false" title="false" >}} <strong class="me-auto">Bootstrap</strong> - <small class="text-muted">2 seconds ago</small> + <small class="text-body-secondary">2 seconds ago</small> <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> </div> <div class="toast-body"> @@ -271,7 +261,7 @@ For systems that generate more notifications, consider using a wrapping element You can also get fancy with flexbox utilities to align toasts horizontally and/or vertically. -{{< example class="bg-dark bd-example-toasts d-flex" >}} +{{< example class="bd-example-toasts d-flex" >}} <!-- Flexbox container for aligning the toasts --> <div aria-live="polite" aria-atomic="true" class="d-flex justify-content-center align-items-center w-100"> @@ -308,7 +298,7 @@ As the content you're displaying changes, be sure to update the [`delay` timeout When using `autohide: false`, you must add a close button to allow users to dismiss the toast. -{{< example class="bg-light" >}} +{{< example >}} <div role="alert" aria-live="assertive" aria-atomic="true" class="toast" data-bs-autohide="false"> <div class="toast-header"> {{< placeholder width="20" height="20" background="#007aff" class="rounded me-2" text="false" title="false" >}} @@ -368,7 +358,7 @@ const toastList = [...toastElList].map(toastEl => new bootstrap.Toast(toastEl, o ### Methods {{< callout danger >}} -{{< partial "callout-danger-async-methods.md" >}} +{{< partial "callouts/danger-async-methods.md" >}} {{< /callout >}} {{< bs-table "table" >}} diff --git a/site/content/docs/5.2/components/tooltips.md b/site/content/docs/5.3/components/tooltips.md index a106d9d..cf628e3 100644 --- a/site/content/docs/5.2/components/tooltips.md +++ b/site/content/docs/5.3/components/tooltips.md @@ -23,11 +23,11 @@ Things to know when using the tooltip plugin: Got all that? Great, let's see how they work with some examples. {{< callout info >}} -{{< partial "callout-info-sanitizer.md" >}} +{{< partial "callouts/info-sanitizer.md" >}} {{< /callout >}} {{< callout info >}} -{{< partial "callout-info-prefersreducedmotion.md" >}} +{{< partial "callouts/info-prefersreducedmotion.md" >}} {{< /callout >}} ## Examples @@ -46,12 +46,11 @@ const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstra Hover over the links below to see tooltips: {{< example class="tooltip-demo" stackblitz_add_js="true" >}} -<p class="muted">Placeholder text to demonstrate some <a href="#" data-bs-toggle="tooltip" data-bs-title="Default tooltip">inline links</a> with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of <a href="#" data-bs-toggle="tooltip" data-bs-title="Another tooltip">real text</a>. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you've now seen how <a href="#" data-bs-toggle="tooltip" data-bs-title="Another one here too">these tooltips on links</a> can work in practice, once you use them on <a href="#" data-bs-toggle="tooltip" data-bs-title="The last tip!">your own</a> site or project. -</p> +<p class="muted">Placeholder text to demonstrate some <a href="#" data-bs-toggle="tooltip" data-bs-title="Default tooltip">inline links</a> with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of <a href="#" data-bs-toggle="tooltip" data-bs-title="Another tooltip">real text</a>. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you've now seen how <a href="#" data-bs-toggle="tooltip" data-bs-title="Another one here too">these tooltips on links</a> can work in practice, once you use them on <a href="#" data-bs-toggle="tooltip" data-bs-title="The last tip!">your own</a> site or project.</p> {{< /example >}} {{< callout warning >}} -{{< partial "callout-warning-data-bs-title-vs-title.md" >}} +{{< partial "callouts/warning-data-bs-title-vs-title.md" >}} {{< /callout >}} ### Custom tooltips @@ -136,9 +135,7 @@ As part of Bootstrap’s evolving CSS variables approach, tooltips now use local ## Usage -The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element. - -Trigger the tooltip via JavaScript: +The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element. Trigger the tooltip via JavaScript: ```js const exampleEl = document.getElementById('example') @@ -146,9 +143,7 @@ const tooltip = new bootstrap.Tooltip(exampleEl, options) ``` {{< callout warning >}} -##### Overflow `auto` and `scroll` - -Tooltip position attempts to automatically change when a **parent container** has `overflow: auto` or `overflow: scroll` like our `.table-responsive`, but still keeps the original placement's positioning. To resolve this, set the [`boundary` option](https://popper.js.org/docs/v2/modifiers/flip/#boundary) (for the flip modifier using the `popperConfig` option) to any HTMLElement to override the default value, `'clippingParents'`, such as `document.body`: +Tooltips automatically attempt to change positions when a parent container has `overflow: auto` or `overflow: scroll`, but still keeps the original placement's positioning. Set the [`boundary` option](https://popper.js.org/docs/v2/modifiers/flip/#boundary) (for the flip modifier using the `popperConfig` option) to any HTMLElement to override the default value, `'clippingParents'`, such as `document.body`: ```js const tooltip = new bootstrap.Tooltip('#example', { @@ -162,9 +157,7 @@ const tooltip = new bootstrap.Tooltip('#example', { The required markup for a tooltip is only a `data` attribute and `title` on the HTML element you wish to have a tooltip. The generated markup of a tooltip is rather simple, though it does require a position (by default, set to `top` by the plugin). {{< callout warning >}} -##### Making tooltips work for keyboard and assistive technology users - -You should only add tooltips to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as `<span>`s) can be made focusable by adding the `tabindex="0"` attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce the tooltip in this situation. Additionally, do not rely solely on `hover` as the trigger for your tooltip, as this will make your tooltips impossible to trigger for keyboard users. +**Keep tooltips accessible to keyboard and assistive technology users** by only adding them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). While other HTML elements can be made focusable by adding `tabindex="0"`, this can create annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce tooltips in this situation. Additionally, do not rely solely on `hover` as the trigger for your tooltips as this will make theme impossible to trigger for keyboard users. {{< /callout >}} ```html @@ -221,7 +214,7 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt | `sanitizeFn` | null, function | `null` | Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization. | | `selector` | string, false | `false` | If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to also apply tooltips to dynamically added DOM elements (`jQuery.on` support). See [this issue]({{< param repo >}}/issues/4215) and [an informative example](https://codepen.io/Johann-S/pen/djJYPb). **Note**: `title` attribute must not be used as a selector. | | `template` | string | `'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'` | Base HTML to use when creating the tooltip. The tooltip's `title` will be injected into the `.tooltip-inner`. `.tooltip-arrow` will become the tooltip's arrow. The outermost wrapper element should have the `.tooltip` class and `role="tooltip"`. | -| `title` | string, element, function | `''` | Default title value if `title` attribute isn't present. If a function is given, it will be called with its `this` reference set to the element that the popover is attached to. | +| `title` | string, element, function | `''` | The tooltip title. If a function is given, it will be called with its `this` reference set to the element that the popover is attached to. | | `trigger` | string | `'hover focus'` | How tooltip is triggered: click, hover, focus, manual. You may pass multiple triggers; separate them with a space. `'manual'` indicates that the tooltip will be triggered programmatically via the `.tooltip('show')`, `.tooltip('hide')` and `.tooltip('toggle')` methods; this value cannot be combined with any other trigger. `'hover'` on its own will result in tooltips that cannot be triggered via the keyboard, and should only be used if alternative methods for conveying the same information for keyboard users is present. | {{< /bs-table >}} @@ -246,7 +239,7 @@ const tooltip = new bootstrap.Tooltip(element, { ### Methods {{< callout danger >}} -{{< partial "callout-danger-async-methods.md" >}} +{{< partial "callouts/danger-async-methods.md" >}} {{< /callout >}} {{< bs-table "table" >}} @@ -274,7 +267,7 @@ tooltip.setContent({ '.tooltip-inner': 'another title' }) ``` {{< callout info >}} -The `setContent` method accepts an `object` argument, where each property-key is a valid `string` selector within the popover template, and each related property-value can be `string` | `element` | `function` | `null` +The `setContent` method accepts an `object` argument, where each property-key is a valid `string` selector within the tooltip template, and each related property-value can be `string` | `element` | `function` | `null` {{< /callout >}} ### Events @@ -283,10 +276,10 @@ The `setContent` method accepts an `object` argument, where each property-key is | Event | Description | | --- | --- | | `hide.bs.tooltip` | This event is fired immediately when the `hide` instance method has been called. | -| `hidden.bs.tooltip` | This event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete). | +| `hidden.bs.tooltip` | This event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete). | | `inserted.bs.tooltip` | This event is fired after the `show.bs.tooltip` event when the tooltip template has been added to the DOM. | | `show.bs.tooltip` | This event fires immediately when the `show` instance method is called. | -| `shown.bs.tooltip` | This event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete). | +| `shown.bs.tooltip` | This event is fired when the tooltip has been made visible to the user (will wait for CSS transitions to complete). | {{< /bs-table >}} ```js |