Skip to content

Toast

<Toast /> renders a single toast card.

It is used internally by <ToastContainer />, but can also be used standalone.

Props

PropTypeRequiredDescription
toastToastStandaloneInstance | ToastInstanceyesToast payload
progressResetKeynumbernoChanges restart progress animation
duplicateKeynumbernoChanges trigger bump animation
updateKeynumbernoChanges trigger update animation
bumpAnimationClassstringnoDuplicate animation class
clearAllAnimationClassstringnoClear-all animation class
updateAnimationClassstringnoUpdate animation class

Events

EventPayloadMeaning
dismissToastIdRequest dismissal

Slot Support

Named slots:

  • icon
  • progress
  • created-at
  • close-icon
  • default slot for body extension

See Slots for details.

Accessibility Behavior

  • Role is alert for error and warning, otherwise status.
  • aria-live is assertive for error and warning, otherwise polite.
  • ARIA labels are generated from title, description, and created-at text.

Standalone Mode

When using <Toast /> directly with partial data:

  • missing id is auto-generated from timestamp
  • missing type defaults to default
  • missing createdAt defaults to Date.now()
  • progressBar defaults to false
  • duration defaults to Infinity

Click And Interaction Rules

  • Body click calls onClick if provided.
  • If closeOnClick is true, body click also dismisses.
  • Hover or touch pause uses pauseOnHover and finite duration.
  • If swipeToDismiss is true, dragging/swiping right dismisses the toast with slide+fade feedback.