A toast notification manager that displays toasts at a fixed position on the screen.
Handles creation, positioning, stacking, and auto-dismissal of toast notifications.
Place one <certara-toast-manager> on a page and use the show() method to programmatically show a toast.
const toastManager = document. querySelector ( ' certara-toast-manager ' );
toastManager. show ( ' success ' , {
" message " : " Your changes have been saved. "
import {useRef} from ' react ' ;
import {CertaraButton, CertaraToastManager} from ' @certara/certara-ui-react ' ;
const toastRef = useRef ( null );
const onSave = () => toastRef.current. show ( ' success ' , {prefix : ' Success! ' , message : ' Your changes have been saved. ' });
< CertaraToastManager ref ={ toastRef } />
< CertaraButton onCertaraClick ={ onSave } >Save</ CertaraButton >
import {Component, ViewChild} from ' @angular/core ' ;
import {CertaraToastManager} from ' @certara/certara-ui-angular ' ;
<certara-toast-manager></certara-toast-manager>
<certara-button (certaraClick)="onSave()">Save</certara-button>
export class SaveComponent {
@ ViewChild ( CertaraToastManager ) toasts !: CertaraToastManager ;
this .toasts. show ( ' success ' , {prefix : ' Success! ' , message : ' Your changes have been saved. ' });
gap
Attribute gapType numberDefault 8Required falseDescription Gap between stacked toasts in pixels
maxToasts
Attribute max-toastsType numberDefault 0Required falseDescription Maximum number of toasts to show at once (0 = unlimited)
position
Attribute positionType "bottom-center" | "bottom-left" | "bottom-right" | "top-center" | "top-left" | "top-right"Default 'top-center'Required falseDescription Position of the toast container on the screen
There are no events available for this component
Name Signature Description 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
Name Description Not used directly; toasts are created programmatically via the show() method