About
A fixed-position toast notification host that renders a stack of dismissible success/error/info messages portaled to the document body, with a hook to push toasts from anywhere in the tree. Ported to React from hemingtsai's Zemponet ZToastHost.vue (MIT).
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Z Toast Host to your project and fits it to your theme.
Code
How Z Toast Host is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import ZToastHost from "@/components/ui/ztoast-host";
import { useToast } from "@/components/ui/ztoast-host-utils/use-toast";
function DemoControls() {
const toast = useToast();
return (
<div
style={{
display: "flex",
gap: 8,
flexWrap: "wrap",
justifyContent: "center",
}}
>
<button
type="button"
style={{
padding: "8px 14px",
border: "1px solid #000",
background: "#fff",
cursor: "pointer",
}}
onClick={() => toast.push("Saved successfully", { kind: "ok" })}
>
Show success toast
</button>
<button
type="button"
style={{
padding: "8px 14px",
border: "1px solid #000",
background: "#fff",
cursor: "pointer",
}}
onClick={() => toast.push("Something went wrong", { kind: "error" })}
>
Show error toast
</button>
<button
type="button"
style={{
padding: "8px 14px",
border: "1px solid #000",
background: "#fff",
cursor: "pointer",
}}
onClick={() =>
toast.push("Heads up: a new version is available", { kind: "info" })
}
>
Show info toast
</button>
</div>
);
}
export default function ZToastHostDemo() {
return (
<div className="w-full h-screen flex items-center justify-center">
<ZToastHost position="bottom-right" limit={4}>
<DemoControls />
</ZToastHost>
</div>
);
}






