diff --git a/apps/browser/src/popup/app.component.ts b/apps/browser/src/popup/app.component.ts
index a97d001c54b..66be31969dd 100644
--- a/apps/browser/src/popup/app.component.ts
+++ b/apps/browser/src/popup/app.component.ts
@@ -35,9 +35,12 @@ import { DesktopSyncVerificationDialogComponent } from "./components/desktop-syn
selector: "app-root",
styles: [],
animations: [routerTransition],
- template: `
diff --git a/libs/components/src/toast/toast.mdx b/libs/components/src/toast/toast.mdx
index 69b0ddf6a08..d27109b4772 100644
--- a/libs/components/src/toast/toast.mdx
+++ b/libs/components/src/toast/toast.mdx
@@ -10,21 +10,45 @@ import { ToastService } from "@bitwarden/components";
# Toast
-
-
-
-## Stories
-
-### Default
+Toasts are ephemeral notifications. They most often communicate the result of a user action. Due to
+their ephemeral nature, long messages and critical alerts should not utilize toasts.
-### Long Content
-
-Avoid using long messages in toasts.
-
-### Service
+## Displaying a toast
+
+Toasts are triggered via the `ToastService`, which must be called from a frontend Angular context.
+
+```
+toastService.showToast({
+ variant: 'success',
+ message: 'Hi I'm a toast,
+});
+```
+
+The following options are accepted:
+
+| Option | Description |
+| --------- | --------------------------------------------- |
+| `variant` | `"success" \| "error" \| "info" \| "warning"` |
+| `title` | Optional title `string` |
+| `message` | Main toast content. Required `string` |
+
+## Toast container
+
+`bit-toast-container` should be added to the app root of consuming clients to ensure toasts are
+properly announced to screenreaders.
+
+```
+
+
+```
+
+## Accessibility
+
+In addition to the accessibility provided by the `bit-toast-container` component, the toast itself
+will apply `aria-alert="true"` if the toast is of type `error`.
diff --git a/libs/components/src/toast/toast.module.ts b/libs/components/src/toast/toast.module.ts
index bf17fde223f..647ccadc4fe 100644
--- a/libs/components/src/toast/toast.module.ts
+++ b/libs/components/src/toast/toast.module.ts
@@ -1,11 +1,12 @@
import { ModuleWithProviders, NgModule } from "@angular/core";
import { DefaultNoComponentGlobalConfig, GlobalConfig, TOAST_CONFIG } from "ngx-toastr";
+import { ToastContainerComponent } from "./toast-container.component";
import { BitwardenToastrComponent } from "./toastr.component";
@NgModule({
- imports: [BitwardenToastrComponent],
- exports: [BitwardenToastrComponent],
+ imports: [BitwardenToastrComponent, ToastContainerComponent],
+ exports: [BitwardenToastrComponent, ToastContainerComponent],
})
export class ToastModule {
static forRoot(config: Partial = {}): ModuleWithProviders {
diff --git a/libs/components/src/toast/toast.stories.ts b/libs/components/src/toast/toast.stories.ts
index abb737f5c23..0af4974eead 100644
--- a/libs/components/src/toast/toast.stories.ts
+++ b/libs/components/src/toast/toast.stories.ts
@@ -33,7 +33,7 @@ export default {
decorators: [
moduleMetadata({
- imports: [CommonModule, BrowserAnimationsModule, ButtonModule],
+ imports: [CommonModule, BrowserAnimationsModule, ButtonModule, ToastModule],
declarations: [ToastServiceExampleComponent],
}),
applicationConfig({
@@ -47,6 +47,7 @@ export default {
success: "Success",
error: "Error",
warning: "Warning",
+ info: "Info",
});
},
},
@@ -103,7 +104,9 @@ export const Service: Story = {
props: {
toastOptions: args,
},
- template: `
+ template: /*html*/ `
+
+
`,
}),
diff --git a/libs/components/src/toast/toastr.component.ts b/libs/components/src/toast/toastr.component.ts
index 24209054948..c93e96150ad 100644
--- a/libs/components/src/toast/toastr.component.ts
+++ b/libs/components/src/toast/toastr.component.ts
@@ -1,6 +1,6 @@
import { animate, state, style, transition, trigger } from "@angular/animations";
import { Component } from "@angular/core";
-import { Toast as BaseToastrComponent } from "ngx-toastr";
+import { Toast as BaseToastrComponent, ToastPackage, ToastrService } from "ngx-toastr";
import { ToastComponent } from "./toast.component";
@@ -27,4 +27,8 @@ import { ToastComponent } from "./toast.component";
standalone: true,
imports: [ToastComponent],
})
-export class BitwardenToastrComponent extends BaseToastrComponent {}
+export class BitwardenToastrComponent extends BaseToastrComponent {
+ constructor(toastrService: ToastrService, toastPackage: ToastPackage) {
+ super(toastrService, toastPackage);
+ }
+}