Skip to content

Toast manager

A toast notification manager that displays toasts at a fixed position on the screen. Handles creation, positioning, stacking, and auto-dismissal of toast notifications.

HTML
React
Angular
Show success toast
<certara-toast-manager></certara-toast-manager>
import { CertaraToastManager } from '@certara/certara-ui-react';
<CertaraToastManager />
// In your module (e.g., app.module.ts)
import { CertaraUiAngularModule } from '@certara/certara-ui-angular';
@NgModule({
imports: [CertaraUiAngularModule]
})
// In your template:
<certara-toast-manager></certara-toast-manager>
Show three toasts
<certara-toast-manager gap="24"></certara-toast-manager>
import { CertaraToastManager } from '@certara/certara-ui-react';
<CertaraToastManager gap={24} />
// In your module (e.g., app.module.ts)
import { CertaraUiAngularModule } from '@certara/certara-ui-angular';
@NgModule({
imports: [CertaraUiAngularModule]
})
// In your template:
<certara-toast-manager gap="24"></certara-toast-manager>

Place one <certara-toast-manager> on a page and use the show() method to programmatically show a toast.

HTML
React
Angular
const toastManager = document.querySelector('certara-toast-manager');
toastManager.show('success', {
"prefix": "Success!",
"message": "Your changes have been saved."
});
import {useRef} from 'react';
import {CertaraButton, CertaraToastManager} from '@certara/certara-ui-react';
function SaveButton() {
const toastRef = useRef(null);
const onSave = () => toastRef.current.show('success', {prefix: 'Success!', message: 'Your changes have been saved.'});
return (
<>
<CertaraToastManager ref={toastRef} />
<CertaraButton onCertaraClick={onSave}>Save</CertaraButton>
</>
);
}
import {Component, ViewChild} from '@angular/core';
import {CertaraToastManager} from '@certara/certara-ui-angular';
@Component({
selector: 'app-save',
template: `
<certara-toast-manager></certara-toast-manager>
<certara-button (certaraClick)="onSave()">Save</certara-button>
`,
})
export class SaveComponent {
@ViewChild(CertaraToastManager) toasts!: CertaraToastManager;
onSave() {
this.toasts.show('success', {prefix: 'Success!', message: 'Your changes have been saved.'});
}
}

gap

Attributegap
Typenumber
Default8
Requiredfalse
DescriptionGap between stacked toasts in pixels

maxToasts

Attributemax-toasts
Typenumber
Default0
Requiredfalse
DescriptionMaximum number of toasts to show at once (0 = unlimited)

position

Attributeposition
Type"bottom-center" | "bottom-left" | "bottom-right" | "top-center" | "top-left" | "top-right"
Default'top-center'
Requiredfalse
DescriptionPosition of the toast container on the screen

There are no events available for this component

NameSignatureDescription
closeAll() => Promise<void>Close all currently visible toasts
getToastCount() => Promise<number>Get the current number of visible toasts
show(type: VariantType, options: ToastOptions, allowMultiple?: boolean) => Promise<ToastHandle>Show a toast notification
NameDescription
Not used directly; toasts are created programmatically via the show() method