--- 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). - Toast are opt-in for performance reasons, so **you must initialize them yourself**. - Toast will auto hide if you do not specify `autohide: false` Got all that? Great, let's see how they work with some examples. ## 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.
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. |