diff --git a/scss/_close.scss b/scss/_close.scss
index 037df16669..35bdc35600 100644
--- a/scss/_close.scss
+++ b/scss/_close.scss
@@ -35,3 +35,7 @@
opacity: $btn-close-disabled-opacity;
}
}
+
+.btn-close-white {
+ filter: invert(1);
+}
diff --git a/scss/_toasts.scss b/scss/_toasts.scss
index 4db51b6b04..e2b98e6008 100644
--- a/scss/_toasts.scss
+++ b/scss/_toasts.scss
@@ -36,6 +36,11 @@
background-clip: padding-box;
border-bottom: $toast-border-width solid $toast-header-border-color;
@include border-top-radius(subtract($toast-border-radius, $toast-border-width));
+
+ .btn-close {
+ margin-right: $toast-padding-x / -2;
+ margin-left: $toast-padding-x;
+ }
}
.toast-body {
diff --git a/scss/_variables.scss b/scss/_variables.scss
index 84a1f4abc4..abd2d8d934 100644
--- a/scss/_variables.scss
+++ b/scss/_variables.scss
@@ -1071,7 +1071,7 @@ $popover-arrow-outer-color: fade-in($popover-border-color, .05) !default
$toast-max-width: 350px !default;
$toast-padding-x: .75rem !default;
-$toast-padding-y: .25rem !default;
+$toast-padding-y: .5rem !default;
$toast-font-size: .875rem !default;
$toast-color: null !default;
$toast-background-color: rgba($white, .85) !default;
diff --git a/site/content/docs/5.0/components/close-button.md b/site/content/docs/5.0/components/close-button.md
index 1a83d7a96f..ba4d17bdc5 100644
--- a/site/content/docs/5.0/components/close-button.md
+++ b/site/content/docs/5.0/components/close-button.md
@@ -3,11 +3,30 @@ layout: docs
title: Close button
description: A generic close button for dismissing content like modals and alerts.
group: components
+toc: true
---
-**Be sure to include text for screen readers**, as we've done with `aria-label`. Disabled close buttons have `pointer-events: none` and `user-select: none` applied to preventing hover and active states from triggering.
+## 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 >}}
+{{< /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 >}}
{{< /example >}}
+
+## White variant
+
+Change the default `.btn-close` to be white with the `.btn-close-white` class. This class uses the `backdrop-filter` property to invert the `background-image`.
+
+{{< example class="bg-dark" >}}
+
+
+{{< /example >}}
diff --git a/site/content/docs/5.0/components/toasts.md b/site/content/docs/5.0/components/toasts.md
index ee8eba4585..06d4fa37e8 100644
--- a/site/content/docs/5.0/components/toasts.md
+++ b/site/content/docs/5.0/components/toasts.md
@@ -34,9 +34,7 @@ Toasts are as flexible as you need and have very little required markup. At a mi
{{< placeholder width="20" height="20" background="#007aff" class="rounded mr-2" text="false" title="false" >}}
Bootstrap
11 mins ago
-
+
Hello, world! This is a toast message.
@@ -54,9 +52,7 @@ Toasts are slightly translucent, too, so they blend over whatever they might app
{{< placeholder width="20" height="20" background="#007aff" class="rounded mr-2" text="false" title="false" >}}
Bootstrap
11 mins ago
-
+
Hello, world! This is a toast message.
@@ -74,9 +70,7 @@ When you have multiple toasts, we default to vertically stacking them in a reada
{{< placeholder width="20" height="20" background="#007aff" class="rounded mr-2" text="false" title="false" >}}
Bootstrap
just now
-
+
See? Just like this.
@@ -88,9 +82,7 @@ When you have multiple toasts, we default to vertically stacking them in a reada
{{< placeholder width="20" height="20" background="#007aff" class="rounded mr-2" text="false" title="false" >}}
Bootstrap
2 seconds ago
-
+
Heads up, toasts will stack automatically
@@ -103,16 +95,11 @@ When you have multiple toasts, we default to vertically stacking them in a reada
Customize your toasts by removing sub-components, tweaking with [utilities]({{< docsref "/utilities/api" >}}), or 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" >}}
-
+
Hello, world! This is a toast message.
-
+
{{< /example >}}
@@ -135,16 +122,11 @@ 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 utilities]({{< docsref "/utilities/colors" >}}). Here we've added `.bg-primary` and `.text-white` to the `.toast`, and then added `.text-white` to our close button. For a crisp edge, we remove the default border with `.border-0`.
{{< example class="bg-light" >}}
-
+
Hello, world! This is a toast message.
-
+
{{< /example >}}
@@ -159,9 +141,7 @@ Place toasts with custom CSS as you need them. The top right is often used for n
{{< placeholder width="20" height="20" background="#007aff" class="rounded mr-2" text="false" title="false" >}}
Bootstrap
11 mins ago
-
+
Hello, world! This is a toast message.
@@ -183,9 +163,7 @@ For systems that generate more notifications, consider using a wrapping element
{{< placeholder width="20" height="20" background="#007aff" class="rounded mr-2" text="false" title="false" >}}
Bootstrap
just now
-
+
See? Just like this.
@@ -197,9 +175,7 @@ For systems that generate more notifications, consider using a wrapping element
{{< placeholder width="20" height="20" background="#007aff" class="rounded mr-2" text="false" title="false" >}}
Bootstrap
2 seconds ago
-
+
Heads up, toasts will stack automatically
@@ -221,9 +197,7 @@ You can also get fancy with flexbox utilities to align toasts horizontally and/o
{{< placeholder width="20" height="20" background="#007aff" class="rounded mr-2" text="false" title="false" >}}
Bootstrap
11 mins ago
-
+
Hello, world! This is a toast message.
@@ -256,9 +230,7 @@ When using `autohide: false`, you must add a close button to allow users to dism
{{< placeholder width="20" height="20" background="#007aff" class="rounded mr-2" text="false" title="false" >}}
Bootstrap
11 mins ago
-
+
Hello, world! This is a toast message.
diff --git a/site/content/docs/5.0/migration.md b/site/content/docs/5.0/migration.md
index 01f33d4449..91cfb456d2 100644
--- a/site/content/docs/5.0/migration.md
+++ b/site/content/docs/5.0/migration.md
@@ -53,6 +53,7 @@ toc: true
- Renamed `.close` to `.btn-close` for a less generic name.
- Close buttons now use a `background-image` (embedded SVG) instead of a `×` in the HTML, allowing for easier customization without the need to touch your markup.
- Added new variables to better control the customization.
+- Added new `.btn-close-white` variant that uses `backdrop-filter: invert(1)` to enable higher contrast dismiss icons against darker backgrounds.
#### Navs