Configuration
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.
packages/core/src/types.ts. The reference below covers the most common options.Layout & Position
"top-right"."left"."16px"."8px"."350px".9999.false.<ToastContainer id> (details). No default.Timing & Progress
5000. Infinity / 0 = no auto-dismiss.true."resume" continues the remaining time, "reset" restarts the full duration. Default: "resume".true."right-to-left".false.Stacking & Queue
5. <= 0 = no cap.false."newest".false.Interaction
true.false.false.Content & Appearance
true.false.bg, color, accentColor, …). Works globally and per-toast — per-toast values merge over the global ones (details). No default.Per-Toast Only Options
Available on show, typed helpers, and update — not in global config:
Example
import { createToastflow } from "vue-toastflow";
app.use(
createToastflow({
position: "top-right",
duration: 5000,
maxVisible: 4,
queue: true,
pauseStrategy: "resume",
preventDuplicates: true,
}),
);
toast.warning({
title: "Server maintenance",
position: "bottom-center",
duration: 15000,
closeOnClick: true,
buttons: {
alignment: "bottom-right",
buttons: [{ label: "Dismiss" }],
},
});
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.ToastButtonsConfig for the complete shape.