Skip to content
RefineUI

Toast

Transient notification message overlay.

Overview

Machine-readable contract from Component Spec.

component: toastexport: Toastversion: 1recipe: toasttokens.visual: toastattributes: data-refineui=toast

Anatomy

Partdata-refineui
roottoast
icontoast-icon
itemtoast-item
scale_layertoast-scale-layer
toastertoaster

Variants

AxisValues
variantdefault, success, error, warning

States

ScopeCategoryValues
componentenvironmentforced-colors, dir, prefers-contrast

Accessibility

SlotElementRole
toastdivstatus

Layout

PropertyValue
directionlogical
rtltrue

Variant

Select a recipe variant — preview and Recipe → Tokens update together.

Recipe → Tokens

Slot bindings for variant="success" — declared in toast.recipe.ts.

SlotVariantPropertyTraceSemanticLight → foundationDark → foundationRecipe class
rootbackgroundtoast.backgroundsurfacePopoverneutralWhiteneutral750bg-refineui-alias-surface-popover
messageforegroundtoast.messageforegroundPrimaryprimaryBlackneutralWhitetext-refineui-alias-foreground-primary
iconsuccessforegroundtoast.accent.successforegroundSuccessgreen700green200text-refineui-alias-foreground-success

Component token trace

All paths in token-trace-v2.json prefixed with toast.

TraceSemanticLight foundationDark foundationLightDark
toast.accent.defaultforegroundPrimaryprimaryBlackneutralWhite#212121#FFFFFF
toast.accent.errorforegroundErrorred700red200#D93A3A#FFC3C3
toast.accent.successforegroundSuccessgreen700green200#1D8822#5BEE62
toast.accent.warningforegroundWarningyellow700yellow200#967000#FFCB2F
toast.backgroundsurfacePopoverneutralWhiteneutral750#FFFFFF#333333
toast.messageforegroundPrimaryprimaryBlackneutralWhite#212121#FFFFFF
npm install @refineui/react @refineui/tokens
import { Toast, Toaster, toast } from "@refineui/react";
// Add Toaster to your app root (one toast at a time by default)
<Toaster />
// Show a toast — replaces any currently visible toast
toast("Settings saved successfully", {
variant: "success",
duration: 3000,
});
toast("Upload failed", {
variant: "error",
action: {
label: "Retry",
onClick: () => retryUpload(),
},
});

Swipe or drag the toast upward to dismiss it early.

PropDefaultTypeDescription
variant"default""default" | "success" | "error" | "warning"Toast visual variant.
messageReactNodeToast message.
iconReactNodeCustom icon element.
iconNamestringIcon name (when not using icon).
actionReactNode | ToastActionAction button or custom element.
PropDefaultTypeDescription
maxToasts1numberMaximum simultaneous toasts. Default replaces the previous toast.
swipeDirections["top"]("top" | "right" | "bottom" | "left")[]Allowed swipe-to-dismiss directions.

Function to show a toast programmatically. A new call replaces the previous toast.

Options:

  • variant?: ToastVariant — Visual variant
  • icon?: ReactNode — Custom icon
  • action?: ToastAction — Action button
  • duration?: number — Duration in milliseconds (default 4200)