--- 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. ## Overview Things to know when using the toast plugin: - If you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util). - Toasts are opt-in for performance reasons, so **you must initialize them yourself**. - **Please note that you are responsible for positioning toasts.** - Toasts will automatically hide if you do not specify `autohide: false`. ## Examples ### Basic To encourage extensible and predictable toasts, we recommend a header and body. Toast headers use `display: flex`, allowing easy alignment of content thanks to our margin and flexbox utilities. 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.
Name | Type | Default | Description |
---|---|---|---|
animation | boolean | true | Apply a CSS fade transition to the toast |
autohide | boolean | true | Auto hide the toast |
delay | number |
500
|
Delay hiding the toast (ms) |
Event Type | Description |
---|---|
show.bs.toast | This event fires immediately when the show instance method is called. |
shown.bs.toast | This event is fired when the toast has been made visible to the user. |
hide.bs.toast | This event is fired immediately when the hide instance method has been called. |
hidden.bs.toast | This event is fired when the toast has finished being hidden from the user. |