Bootstrap 5 Tutorial
The toast component is basically an alert box that is only visible for a couple of seconds when something happens (i.e. when the user clicks on a button, submits a form, etc.).
Use the .toast class and include a .toast-header and .toast-body to construct a toast.
Note: By default, toasts are hidden. If you wish to display it, use the .show class. Use a <button> element and add data-bs-dismiss=”toast” to close it:
Toast Header
Some text inside the toast body
You must initialize it with JavaScript in order for a button click to display a toast: Call the toast() function after selecting the designated element.
When you click a button, the following code will display all of the “toasts” in the document:
CodingAsk.com is designed for learning and practice. Examples may be made simpler to aid understanding. Tutorials, references, and examples are regularly checked for mistakes, but we cannot guarantee complete accuracy. By using CodingAsk.com, you agree to our terms of use, cookie, and privacy policy.
Copyright 2010-2024 by Refsnes Data. All Rights Reserved.