Notifications
Bootstrap Toasts
Push notifications to your visitors with a toast, a lightweight and easily customizable alert message.
Basic
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.
Translucent
Toasts are slightly translucent, too, so they blend over whatever they might appear over. For browsers that support the backdrop-filter CSS property, we’ll also attempt to blur the elements under a toast.
Stacking
When you have multiple toasts, we default to vertiaclly stacking them in a readable manner.
Placement
Place toasts with custom CSS as you
need them. The top right is often used for
notifications, as is the top middle. If you’re only ever going
to show one toast at a time, put the positioning
styles right on the .toast
.
<!-- Basic Toast -->
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header">
<img src="assets/images/logo_sm_dark.png" alt="brand-logo" height="12" class="mr-1" />
<strong class="mr-auto">Hyper</strong>
<small>11 mins ago</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body">
Hello, world! This is a toast message.
</div>
</div> <!--end toast-->
<!-- Translucent Toast -->
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header">
<img src="assets/images/logo_sm_dark.png" alt="brand-logo" height="12" class="mr-1" />
<strong class="mr-auto">Hyper</strong>
<small>11 mins ago</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body">
Hello, world! This is a toast message.
</div>
</div> <!--end toast-->
<!-- Stacking Toast -->
<div aria-live="polite" aria-atomic="true" style="position: relative; min-height: 200px;">
<!-- Position it -->
<div style="position: absolute; top: 0; right: 0;">
<!-- Then put toasts within -->
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header">
<img src="assets/images/logo_sm_dark.png" alt="brand-logo" height="12" class="mr-1" />
<strong class="mr-auto">Hyper</strong>
<small class="text-muted">just now</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body">
See? Just like this.
</div>
</div> <!--end toast-->
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header">
<img src="assets/images/logo_sm_dark.png" alt="brand-logo" height="12" class="mr-1" />
<strong class="mr-auto">Hyper</strong>
<small class="text-muted">2 seconds ago</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body">
Heads up, toasts will stack automatically
</div>
</div> <!--end toast-->
</div>
</div>
<!-- Placement Toast -->
<div aria-live="polite" aria-atomic="true" class="d-flex justify-content-center align-items-center" style="min-height: 200px;">
<!-- Then put toasts within -->
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header">
<img src="assets/images/logo_sm_dark.png" alt="brand-logo" height="12" class="mr-1" />
<strong class="mr-auto">Hyper</strong>
<small>11 mins ago</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body">
Hello, world! This is a toast message.
</div>
</div> <!--end toast-->
</div>
Jquery Toast
Toasts based notifications can be used to to show important alerts or information to users.
Info Example
Warning Example
Success Example
Danger Example
The text can be an array
Put some HTML in the text
Making them sticky
Fade transitions
How to customize the style of toast?
Open file src/scss/custom/plugins/_toaster.scss
and
change the different style to change the background, text or other
colors.
<script>$.NotificationApp.send("Title","Your awesome message text","Position","Background color","Icon")</script>
Following positions for toast are supported at the moment:
-
bottom-left
to show the toast at bottom left position -
bottom-right
to show the toast at bottom right position -
bottom-center
to show the toast at bottom center position -
top-right
to show the toast at top right position -
top-left
to show the toast at top left position -
top-center
to show the toast at top center position -
mid-center
to show the toast at middle position
For more options, please refer to official documentation here