About
Toasts printed dot by dot by a 9-pin printer on tractor-feed paper. Drag to tear.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Dot Matrix Toaster to your project and fits it to your theme.
Code
How Dot Matrix Toaster is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import * as React from "react";
import { DotMatrixToaster, printer } from "@/components/ui/dot-matrix-toaster";
const FONTS = `
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600;700&family=VT323&display=swap');
.dm-demo{font-family:'Geist',ui-sans-serif,system-ui,sans-serif}
.dm-demo .font-mono{font-family:'Geist Mono',ui-monospace,SFMono-Regular,Menlo,monospace}
.dm-demo .font-crt{font-family:'VT323',ui-monospace,monospace}
`;
const JOBS = [
{ key: "deploy", label: "Deploy finished", job: { title: "Deploy complete", body: "main@4f2a1c shipped to production in 42s. 0 errors.", tone: "success" as const } },
{ key: "pay", label: "Payment failed", job: { title: "Payment failed", body: "Card ending 4417 was declined by the issuer.", tone: "error" as const, action: { label: "Retry", onClick: () => printer.print({ title: "Retrying charge", body: "Attempt 2 of 3 queued.", tone: "default" }) } } },
{ key: "disk", label: "Disk warning", job: { title: "Disk at 91%", body: "db-2 /var/lib/postgres. Rotate logs or expand volume.", tone: "warning" as const } },
{ key: "msg", label: "New message", job: { title: "Message from Ada", body: "The analytical engine report is ready. Printing it was your idea.", tone: "default" as const } },
];
export default function DotMatrixDemo() {
const [paper, setPaper] = React.useState("greenbar" as "greenbar" | "plain");
const [sound, setSound] = React.useState(true);
const [quality, setQuality] = React.useState("nlq" as "nlq" | "draft");
const first = React.useRef(false);
React.useEffect(() => {
if (first.current) return;
first.current = true;
const t = window.setTimeout(() => printer.print(JOBS[0].job), 500);
return () => window.clearTimeout(t);
}, []);
return (
<div className="dm-demo relative flex min-h-[820px] w-full items-start justify-center overflow-hidden bg-background px-5 py-14">
<style>{FONTS}</style>
<div aria-hidden className="pointer-events-none absolute inset-0 [background-image:radial-gradient(rgb(128_128_128/0.2)_1px,transparent_1px)] [background-size:18px_18px] [mask-image:radial-gradient(ellipse_at_center,black_15%,transparent_72%)]" />
<div className="relative grid w-full max-w-[880px] gap-10 md:grid-cols-[1fr_368px]">
<div className="pt-4">
<p className="font-mono text-[10.5px] uppercase tracking-[0.24em] text-muted-foreground">Toasts · 9-pin · 160 cps</p>
<h2 className="font-crt mt-2 text-[46px] leading-[0.95] text-foreground">Notifications,<br />on paper.</h2>
<p className="mt-3 max-w-sm text-[14px] leading-relaxed text-muted-foreground">
Every toast prints dot by dot on tractor-feed paper. Drag a sheet to tear it off. Hover to stop auto-tearing.
</p>
<div className="mt-7 grid max-w-sm grid-cols-2 gap-2">
{JOBS.map((j) => (
<button
key={j.key}
type="button"
onClick={() => printer.print(j.job)}
className="h-10 rounded-lg border bg-background px-3 text-left text-[13px] font-medium text-foreground transition-colors hover:bg-muted"
>
{j.label}
</button>
))}
<button
type="button"
onClick={() => [0, 2, 3].forEach((i) => printer.print(JOBS[i].job))}
className="h-10 rounded-lg bg-foreground px-3 text-[13px] font-medium text-background transition-opacity hover:opacity-90"
>
Burst × 3
</button>
<button
type="button"
onClick={() => printer.clear()}
className="h-10 rounded-lg px-3 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
>
Tear all
</button>
</div>
<div className="mt-6 flex flex-wrap items-center gap-4">
<div className="flex rounded-lg border p-0.5">
{(["greenbar", "plain"] as const).map((p) => (
<button
key={p}
type="button"
onClick={() => setPaper(p)}
className={"rounded-md px-2.5 py-1 font-mono text-[10.5px] uppercase tracking-[0.12em] transition-colors " + (paper === p ? "bg-foreground text-background" : "text-muted-foreground hover:text-foreground")}
>
{p}
</button>
))}
</div>
<div className="flex rounded-lg border p-0.5">
{(["nlq", "draft"] as const).map((q) => (
<button
key={q}
type="button"
onClick={() => setQuality(q)}
className={"rounded-md px-2.5 py-1 font-mono text-[10.5px] uppercase tracking-[0.12em] transition-colors " + (quality === q ? "bg-foreground text-background" : "text-muted-foreground hover:text-foreground")}
>
{q}
</button>
))}
</div>
<button
type="button"
onClick={() => setSound((s) => !s)}
aria-pressed={sound}
className="inline-flex items-center gap-1.5 rounded-md px-2 py-1 font-mono text-[10.5px] uppercase tracking-[0.14em] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
>
<svg viewBox="0 0 16 16" className="size-3" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
<path d="M2.5 6h2l3-2.5v9L4.5 10h-2z" />
{sound ? <path d="M10.5 5.5a3.5 3.5 0 0 1 0 5M12.5 3.5a6.3 6.3 0 0 1 0 9" /> : <path d="m10.5 6 4 4m0-4-4 4" />}
</svg>
{sound ? "Sound" : "Muted"}
</button>
</div>
</div>
<DotMatrixToaster position="inline" paper={paper} quality={quality} sound={sound} />
</div>
</div>
);
}








