Skip to content

Slots

Toastflow provides slot APIs on <ToastContainer /> and <Toast />.

ToastContainer Default Slot

When you provide default slot content to <ToastContainer>, you switch to headless card rendering while keeping Toastflow store logic.

Slot props:

PropTypeMeaning
toastToastInstanceCurrent toast item
progressResetKeynumberChanges when timer/progress should restart
duplicateKeynumberChanges when duplicate event is emitted
updateKeynumberChanges when update event is emitted
bumpAnimationClassstringClass name for duplicate bump animation
clearAllAnimationClassstringClass name for clear-all animation
updateAnimationClassstringClass name for update animation
dismiss(id: ToastId) => voidDismiss helper

Example:

vue
<ToastContainer v-slot="{ toast, dismiss, bumpAnimationClass }">
  <article :class="['my-toast', toast.type, bumpAnimationClass]">
    <h4>{{ toast.title }}</h4>
    <p v-if="toast.description">{{ toast.description }}</p>
    <button @click="dismiss(toast.id)">Close</button>
  </article>
</ToastContainer>

Toast Slots

<Toast /> exposes named slots for local customization.

SlotSlot propsPurpose
default{ toast }Add extra content inside body
icon{ toast }Replace default icon component
progress{ toast }Replace progress renderer
created-at{ toast, formatted }Customize created-at rendering
close-icon{ toast }Replace close button icon

Toast Event

<Toast /> emits:

  • dismiss with ToastId

Used by container to call store dismiss action.