1# Toasts
2Use a toast message to indicate the status of a user action. For example, a user saves a form successfully, a toast message with the `success` variant is displayed.  If the user action was not successful, a toast message with the `danger` variant is displayed.
3
4There are different transitions for the toast messages. The `success` toast message will auto-hide after 10 seconds. The user must manually dismiss the `informational`, `warning`, and `error` toast messages.  The `BVToastMixin` provides a simple API that generates a toast message that meets the transition guidelines.
5
6<img src="./toast.png" alt="Toast message examples" style="max-width:350px">
7
8```js{5}
9// Sample method from Reboot BMC page
10rebootBmc() {
11  this.$store
12  .dispatch('controls/rebootBmc')
13  .then(message => this.successToast(message))
14  .catch(({ message }) => this.errorToast(message));
15}
16
17// Methods used in this example
18methods: {
19  makeSuccessToast() {
20    this.successToast('This is a success toast and will be dismissed after 10 seconds.');
21  },
22  makeErrorToast() {
23    this.errorToast('This is an error toast and must be dismissed by the user.');
24  },
25  makeWarningToast() {
26    this.warningToast('This is a warning toast and must be dismissed by the user.');
27  },
28  makeInfoToast() {
29    this.infoToast('This is an info toast and must be dismissed by the user.');
30  },
31}
32```
33
34## Additional options
35
36The first argument for each method will be the toast body content. It accepts a string value or an array of strings for toasts needing to display multiple lines of content.
37
38The BVToastMixin also accepts additional options as a second argument. Pass an object with a `title` property to change the default toast title. Include a `refreshAction` property, set to true, to include a link that refreshes the application. Include a `timestamp` property, set to true, to include a timestamp in the toast.
39
40<img src="./toast-options.png" alt="Toast message options example" style="max-width:350px">
41
42```js
43
44methods: {
45  makeInfoToast() {
46    this.infoToast([
47      'This is a toast with multi-lined body content.',
48      'Just pass an array of strings!'
49      ], {
50      title: 'This is an example',
51      refreshAction: true,
52      timestamp: true
53    })
54  }
55}
56```