Toastflow
Playground
API

Configuration

Global defaults, per-toast overrides, and the resolution order.

Toastflow resolves config in three layers:

Internal defaults

Shipped by toastflow-core.

Global config

Passed to createToastflow(...) (Vue) or createToastStore(...) (headless).

Per-toast overrides

Passed to show, typed helpers, loading, or update.

Full TypeScript definitions:packages/core/src/types.ts. The table below covers the most common options.

Common Options

OptionDefaultWhat it controls
position"top-right"Viewport anchor for the stack
duration5000Auto-dismiss delay in ms. Infinity / 0 = no auto-dismiss
maxVisible5Max visible toasts per position. <= 0 = no cap
queuefalseQueue overflowed toasts instead of evicting
order"newest"Insert order and eviction target
progressBartrueShow progress bar for finite durations
pauseOnHovertruePause timer on hover or touch
pauseStrategy"resume""resume" continues remaining time, "reset" restarts full duration
closeButtontrueShow floating close button
closeOnClickfalseDismiss on body click
showIcontrueShow the type icon
preventDuplicatesfalseDe-duplicate by position + type + title + description
supportHtmlfalseAllow HTML in title and description (use trusted content only)
sanitizerHook sanitizing HTML before render, e.g. DOMPurify (details)
swipeToDismissfalseDismiss with a right swipe/drag
showCreatedAtfalseShow a timestamp badge on the toast
createdAtFormatterlocale timeFunction formatting the timestamp (see below)
alignment"left"Text direction inside the toast body
progressAlignment"right-to-left"Progress animation direction
offset"16px"Distance from viewport edge
gap"8px"Gap between toasts
width"350px"Default toast width
zIndex9999Root container z-index

Per-Toast Only Options

These are available on show, typed helpers, and update — not in global config:

OptionWhat it does
themeCSS accent class, e.g. "brand"tf-toast-accent--brand
cssInline CSS variable overrides (bg, color, accentColor, …)

Example

import { createToastflow } from "vue-toastflow";

app.use(
  createToastflow({
    position: "top-right",
    duration: 5000,
    maxVisible: 4,
    queue: true,
    pauseStrategy: "resume",
    preventDuplicates: true,
  }),
);

Animation Class Names

Override globally or per-toast:

createToastflow({
  animation: {
    name: "MyToastMotion",
    bump: "MyToastBump",
    clearAll: "MyToastClearAll",
    update: "MyToastUpdate",
  },
});

Defaults: Toastflow__animation, Toastflow__animation-bump, Toastflow__animation-clearAll, Toastflow__animation-update.

Timestamps

showCreatedAt: true renders a small badge with the time the toast was created. The default format is the locale time; pass createdAtFormatter to change it:

createToastflow({
  showCreatedAt: true,
  createdAtFormatter: (createdAt) =>
    new Date(createdAt).toLocaleTimeString([], {
      hour: "2-digit",
      minute: "2-digit",
    }),
});
createdAtFormatter is a function, so in Nuxt it cannot live in nuxt.config (config is JSON-serialized). Configure it at runtime instead — see Nuxt notes.

Buttons Config

toast.info({
  title: "Changes saved",
  buttons: {
    alignment: "bottom-right",
    layout: "row",
    buttons: [
      {
        label: "Undo",
        onClick(ctx) {
          console.log("Undo", ctx.id);
        },
      },
    ],
  },
});

Each button supports label or html, plus optional id, ariaLabel, className, dismissOnClick (dismiss before onClick runs), dismissAfterClick (dismiss after onClick runs), and onClick(ctx, event).

html buttons are rendered without sanitization — pass trusted markup only, or sanitize it yourself. Set ariaLabel on html buttons so screen readers can announce them.
Full button types: see ToastButtonsConfig for the complete shape.
Copyright © 2026