summaryrefslogtreecommitdiff
path: root/docs/guide/components/toasts/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/guide/components/toasts/index.md')
-rw-r--r--docs/guide/components/toasts/index.md32
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/guide/components/toasts/index.md b/docs/guide/components/toasts/index.md
new file mode 100644
index 00000000..271155a9
--- /dev/null
+++ b/docs/guide/components/toasts/index.md
@@ -0,0 +1,32 @@
+# Toasts
+Use 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.
+
+There 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.
+
+<img src="./toast.png" alt="Toast message examples" style="max-width:350px">
+
+```js{5}
+// Sample method from Reboot BMC page
+rebootBmc() {
+ this.$store
+ .dispatch('controls/rebootBmc')
+ .then(message => this.successToast(message))
+ .catch(({ message }) => this.errorToast(message));
+}
+
+// Methods used in this example
+methods: {
+ makeSuccessToast() {
+ this.successToast('This is a success toast and will be dismissed after 10 seconds.');
+ },
+ makeErrorToast() {
+ this.errorToast('This is an error toast and must be dismissed by the user.');
+ },
+ makeWarningToast() {
+ this.warningToast('This is a warning toast and must be dismissed by the user.');
+ },
+ makeInfoToast() {
+ this.infoToast('This is an info toast and must be dismissed by the user.');
+ },
+}
+``` \ No newline at end of file