콘텐츠로 이동
RefineUI

Toast

일시적인 알림 메시지 오버레이.

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(),
},
});

토스트를 위쪽으로 스와이프하거나 드래그하면 일찍 닫을 수 있습니다.

PropDefaultTypeDescription
variant"default""default" | "success" | "error" | "warning"Toast 시각적 변형.
messageReactNodeToast 메시지.
iconReactNode커스텀 아이콘 요소.
iconNamestring아이콘 이름(icon 미사용 시).
actionReactNode | ToastAction액션 버튼 또는 커스텀 요소.
PropDefaultTypeDescription
maxToasts1number동시 토스트 최대 개수. 기본은 이전 토스트를 대체합니다.
swipeDirections["top"]("top" | "right" | "bottom" | "left")[]스와이프로 닫을 수 있는 방향.

프로그래밍 방식으로 토스트를 표시하는 함수입니다. 새 호출이 이전 토스트를 대체합니다.

옵션:

  • variant?: ToastVariant — 시각적 변형
  • icon?: ReactNode — 커스텀 아이콘
  • action?: ToastAction — 액션 버튼
  • duration?: number — 지속 시간(밀리초, 기본 4200)