Toast

Base UI toast primitives for customizable stacked notifications.

Base UI toast primitives for customizable stacked notifications.

Note: For simple toast popups in app features, you can also use sonner (@celestia-project/ui/primitive/sonner).

tsx
import {  ToastProvider,  ToastViewport,  Toast,  ToastContent,  ToastTitle,  ToastDescription,  ToastClose,  toast,} from "@celestia-project/ui/primitive/toast"
export function AppToasts() {  return (    <ToastProvider>      <button        onClick={() =>          toast.create({            title: "Notification",            description: "Your settings have been saved.",          })        }      >        Show Toast      </button>      <ToastViewport />    </ToastProvider>  )}

Sub-Components & API

Component / UtilityDescription
ToastProviderRoot context provider for managing toast stack state
ToastViewportFixed container element where toast items are rendered
ToastIndividual toast card element
ToastTitleBold notification heading
ToastDescriptionMuted detail copy
ToastActionInline action button trigger
ToastCloseDismiss button
toast.create(...)Programmatic manager function to spawn a toast