Adding the Toast Component
<CourierToast />

Courier Toast component
<CourierToast /> to your app and authenticate the user with the Courier backend:
If you’re using tenants, you can scope requests to a particular
tenant by passing its ID to the For the full reference of sign in parameters, see the Courier JS docs.
signIn request.Some initialization for toasts is asychronous. If your app displays toasts immediately when
the component is mounted, consider using the
onReady to wait
until the <CourierToast> component is fully initialized.Handle Clicks
Toast Items
| Callback Prop | Type Signature |
|---|---|
onToastItemClick | (props: CourierToastItemClickEvent) => void |
onToastItemClick prop to handle clicks on toast items.
Action Buttons
| Callback Prop | Type Signature |
|---|---|
onToastItemActionClick | (props: CourierToastItemActionClickEvent) => void |

Courier Toast with action buttons
onToastItemActionClick to handle clicks on action buttons within toast items.
Styles and Theming
The fastest way to style Courier Toast to match your app is with a custom theme.Light and Dark Themes
Customize both the light and dark themes. The example below shows custom styling applied to toast items.
Courier Toast with a custom theme
CourierToastTheme
An instance of CourierToastTheme can be set as the light and dark themes respectively.
Custom Elements
Custom Content

Toast with custom item content
| Render Prop | Type Signature |
|---|---|
renderToastItemContent | (props: CourierToastItemFactoryProps) => ReactNode |
renderToastItemContent.
The dismiss button and auto-dismiss functionality are still handled by the default toast item wrapper.
Fully Custom Items
| Render Prop | Type Signature |
|---|---|
renderToastItem | (props: CourierToastItemFactoryProps) => ReactNode |
renderToastItem. This gives you complete control over the toast item,
including its container, styling, and dismiss behavior.
When using renderToastItem, the autoDismiss and autoDismissTimeoutMs props are still
respected, and toasts will be automatically removed after the timeout if autoDismiss is enabled.

Toast with a fully custom item
CourierToast Props
The full set of React props you can pass to the<CourierToast> component.
| Prop Name | Type | Default | Description |
|---|---|---|---|
style | CSSProperties | { position: "fixed", width: "380px", top: "30px", right: "30px", zIndex: 999 } | Styles applied to the toast component. Useful for customizing position and layout. |
lightTheme | CourierToastTheme | undefined | Theme object used when light mode is active. |
darkTheme | CourierToastTheme | undefined | Theme object used when dark mode is active. |
mode | "light" | "dark" | "system" | "system" | Manually set the theme mode. |
autoDismiss | boolean | false | Enable toasts to auto-dismiss with a countdown bar. |
autoDismissTimeoutMs | number | 5000 | Timeout in milliseconds before a toast auto-dismisses. |
dismissButton | "visible" | "hidden" | "hover" | "auto" | "auto" | Set dismiss button visibility. "auto" shows button always if autoDismiss is false, on hover if true. |
onToastItemClick | (props: CourierToastItemClickEvent) => void | undefined | Callback invoked when a toast item is clicked. |
onToastItemActionClick | (props: CourierToastItemActionClickEvent) => void | undefined | Callback invoked when a toast item action button is clicked. |
renderToastItem | (props: CourierToastItemFactoryProps) => ReactNode | undefined | Custom render function for entire toast items. |
renderToastItemContent | (props: CourierToastItemFactoryProps) => ReactNode | undefined | Custom render function for toast item content only. |
onReady | (ready: boolean) => void | undefined | Callback invoked when the component is ready to receive messages. |
Using auto-dismiss

Toast component with auto-dismiss enabled
- Toast items are automatically removed after the specified timeout.
- A countdown bar appears at the top of each toast to indicate the
time remaining before dismissal. This countdown bar is theme-able via
the
autoDismissBarColorvalue inCourierToastTheme. - The dismiss button (x) is only visible on hover, but you can customize
this behavior using the
dismissButtonprop.
Using the onReady Callback
TheonReady callback is invoked when the CourierToast component has finished mounting and is ready to display messages.
When to use onReady
Some initialization for <CourierToast> is asychronous, such as syncing state between
React and the underlying Web Components. If you’re displaying toasts immediately on page load
(for example, with CourierToastDatastore)
or observing issues where toasts do not properly render custom content or click handlers, consider
using onReady to wait for <CourierToast> to fully initialize before acting.
In the example below, onReady is used to toggle the toastReady state, passed
as a dependency to the React effect that performs authentication.