diff --git a/scss/_toasts.scss b/scss/_toasts.scss new file mode 100644 index 000000000..248a21298 --- /dev/null +++ b/scss/_toasts.scss @@ -0,0 +1,29 @@ +.toast { + max-width: $toast-max-width; + overflow: hidden; // cheap rounded corners on nested items + font-size: $toast-font-size; // knock it down to 14px + background-color: $toast-background-color; + background-clip: padding-box; + border: $toast-border-width solid $toast-border-color; + border-radius: $toast-border-radius; + box-shadow: $toast-box-shadow; + backdrop-filter: blur(10px); + + + .toast { + margin-top: $toast-padding-x; + } +} + +.toast-header { + display: flex; + align-items: center; + padding: $toast-padding-y $toast-padding-x; + color: $toast-header-color; + background-color: $toast-header-background-color; + background-clip: padding-box; + border-bottom: $toast-border-width solid $toast-header-border-color; +} + +.toast-body { + padding: $toast-padding-x; // apply to both vertical and horizontal +} diff --git a/scss/_variables.scss b/scss/_variables.scss index c636860bd..ce958b3c4 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -3,7 +3,6 @@ // Variables should follow the `$component-state-property-size` formula for // consistent naming. Ex: $nav-link-disabled-color and $modal-content-box-shadow-xs. - // Color system $white: #fff !default; @@ -860,6 +859,22 @@ $popover-arrow-color: $popover-bg !default; $popover-arrow-outer-color: fade-in($popover-border-color, .05) !default; +// Toasts +$toast-max-width: 350px !default; +$toast-padding-x: .75rem !default; +$toast-padding-y: .25rem !default; +$toast-font-size: .875rem !default; +$toast-background-color: rgba($white, .85) !default; +$toast-border-width: 1px !default; +$toast-border-color: rgba(0,0,0,.1) !default; +$toast-border-radius: .25rem !default; +$toast-box-shadow: 0 .25rem .75rem rgba($black, .1) !default; + +$toast-header-color: $gray-600 !default; +$toast-header-background-color: rgba($white, .85) !default; +$toast-header-border-color: rgba(0, 0, 0, .05) !default; + + // Badges $badge-font-size: 75% !default; diff --git a/scss/bootstrap.scss b/scss/bootstrap.scss index 6f7e4eef1..c9795108c 100644 --- a/scss/bootstrap.scss +++ b/scss/bootstrap.scss @@ -34,6 +34,7 @@ @import "media"; @import "list-group"; @import "close"; +@import "toasts"; @import "modal"; @import "tooltip"; @import "popover"; diff --git a/site/_data/nav.yml b/site/_data/nav.yml index cb0defd89..7b6ff7cd9 100644 --- a/site/_data/nav.yml +++ b/site/_data/nav.yml @@ -50,6 +50,7 @@ - title: Progress - title: Scrollspy - title: Spinners + - title: Toasts - title: Tooltips - title: Utilities diff --git a/site/docs/4.1/components/toasts.md b/site/docs/4.1/components/toasts.md new file mode 100644 index 000000000..df5d2e827 --- /dev/null +++ b/site/docs/4.1/components/toasts.md @@ -0,0 +1,169 @@ +--- +layout: docs +title: Toasts +description: Push notifications to your visitors with a toast, a lightweight and easily customizable alert message. +group: components +toc: true +--- + +Toasts are lightweight notifications designed to mimic the push notifications that have been popularized by mobile and desktop operating systems. They're built with flexbox, so they're easy to align and position. + +## Examples + +A basic toast can include a header (though it doesn't strictly need one) with whatever contents you like. The header is also `display: flex`, so `.mr-auto` and `.ml-auto` can be used for easy pushing of content, as well as all our flexbox utilities. + +