9.2k

Toast

Generates toast notifications.

API Reference

Installation

Add the ToastProvider and AnchoredToastProvider to your app.

app/layout.tsx

Usage

Stacked Toasts

By default, toasts appear in the bottom-right corner. You can change this by setting the position prop on the ToastProvider.

Allowed values: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right. For example:

Anchored Toasts

For toasts positioned relative to a specific element, use anchoredToastManager. The AnchoredToastProvider is typically added to your app layout (alongside ToastProvider), so you can use anchoredToastManager directly in your components:

You can also style anchored toasts like tooltips by passing data: { tooltipStyle: true }. When using tooltip style, only the title is displayed (description and other content are ignored):

API Reference

ToastProvider

Provider component for stacked toasts. Wraps Toast.Provider from Base UI.

AnchoredToastProvider

Provider component for toasts anchored to specific elements. Use with anchoredToastManager.

toastManager

Manager object for creating stacked toasts. Use toastManager.add() to show a toast.

anchoredToastManager

Manager object for creating anchored toasts. Use anchoredToastManager.add() with positionerProps.anchor to show a toast anchored to an element.

ToastViewport

Viewport container for toasts. Styled wrapper for Toast.Viewport from Base UI.

Toast

Individual toast container. Styled wrapper for Toast.Root from Base UI.

ToastTitle

Title text for the toast. Styled wrapper for Toast.Title from Base UI.

ToastDescription

Description text for the toast. Styled wrapper for Toast.Description from Base UI.

ToastAction

Action button for the toast. Styled wrapper for Toast.Action from Base UI.

ToastClose

Close button for the toast. Styled wrapper for Toast.Close from Base UI.

Examples

With Status

Loading

With Action

Promise

With Varying Heights

Copy Button with Anchored Toast

Submit Button with Error Toast

coss.com ui

Built by and for the team of Cal.com, Inc. — the leading commercial open source company (“coss”).