Printer
A tactile physical result-reveal block for SaaS apps. Turns boring async spinners and checkout delays into an authentic thermal receipt printer animation with realistic audio and paper ejection.
Physical Result Reveal Engine
Transform boring async spinners and checkout delays into a tactile mechanical receipt printing experience.
💡 Stepped line-by-line thermal feeding and chassis micro-vibration animate until async actions settle.
Installation
Pro Component
PRODirect CLI installation and source code access are available with Jack UI Pro.
Usage
1. Interactive Showcase Block
Render the full turnkey experience with preset template switcher tabs (Checkout, Invoice, Event Pass, API Key, Recap, Diploma, Coupon, Jam Demo):
import { Printer } from "@/components/jackui/blocks/printer/printer";
export default function Page() {
return (
<Printer
title="Order Confirmation"
subtitle="Your transaction has been processed successfully."
initialTemplate="checkout"
/>
);
}2. Individual Machine with Custom Card
Wrap any custom component inside PrinterMachine to trigger an authentic thermal printing animation while executing an async action (like charging a credit card or generating an API key):
import {
PrinterMachine,
Receipt
} from "@/components/jackui/blocks/printer/printer";
export default function CheckoutPage() {
const handlePayment = async () => {
// Executes your async payment or server action:
await processCheckoutPayment();
};
return (
<PrinterMachine
buttonLabel="Print"
onPrint={handlePayment}
minDuration={2400}
size="md"
soundEnabled={true}
>
<Receipt
storeName="SaaS Store"
orderNumber="#ORD-8821"
total={49.00}
/>
</PrinterMachine>
);
}Real-World Use Cases
The Printer Block replaces standard loading spinners with a tactile, memorable physical moment:
- E-Commerce & SaaS Checkout: When a Stripe/PayPal payment resolves, dispense an itemized receipt with order details and a jagged torn paper boundary.
- Developer Tooling & API Key Minting: Display generated API keys and secrets with masked reveal toggles and instant 1-click clipboard copy.
- Event Passes & Conferences: Issue attendee passes with dynamic attendee names, event titles, and scannable SVG QR codes.
- Milestones & Year-In-Review: Viral achievements and annual metric summaries (Spotify Wrapped / Receiptify style) designed for screenshot sharing.
- Vouchers & Promotional Discounts: Reward customers with a perforated dashed coupon card containing unlockable promo codes.
- Physical POS Sync: Trigger on-screen confirmation synchronized with physical Bluetooth/USB thermal receipt printers.
Component Architecture
The block is built with a flat, modular folder structure inside components/jackui/blocks/printer/:
| File | Purpose |
|---|---|
printer.tsx | Main showcase orchestrator with responsive tab navigation. |
printer-machine.tsx | Core tactile printer hardware unit, mechanical chassis, status LED, and roller animation. |
printer-sound.ts | Zero-dependency Web Audio synthesizer generating realistic stepper-motor, roller feed, and paper tear sound effects. |
receipt.tsx | Itemized retail & checkout thermal receipt with jagged torn edge. |
invoice.tsx | Clean Net-15 professional invoice with item breakdown. |
ticket.tsx | Event ticket with real-time SVG QR code and perforated tear stub. |
welcome-card.tsx | Developer onboarding badge with masked secret API key and reveal toggles. |
recap.tsx | Milestone & achievement card with gradient ambient glow. |
certificate.tsx | Formal completion diploma with double ornamental borders. |
coupon-card.tsx | Promotional discount voucher with dashed perforated cutout boundary. |
printer-mini-preview.tsx | Scaled miniature preview designed for component grid showcases. |
Props
Printer (Block Orchestrator)
| Prop | Type | Description |
|---|---|---|
title | string | Optional. Block header title. Default: "Physical Result Reveal Engine". |
subtitle | string | Optional. Block subtitle text. |
initialTemplate | PrinterTemplateType | Optional. Initial template: "checkout" | "invoice" | "ticket" | "apikey" | "recap" | "certificate" | "coupon" | "error". Default: "checkout". |
showTabs | boolean | Optional. Toggles the template switcher navigation tabs. Default: true. |
children | React.ReactNode | Optional. Custom card to render inside the printer machine instead of demo tabs. |
className | string | Optional. Additional Tailwind classes for the outer wrapper section. |
soundEnabled | boolean | Optional. Enables Web Audio sound effects. Default: true. |
soundVolume | number | Optional. Master audio volume (0 to 1). Default: 0.35. |
PrinterMachine (Hardware Unit)
| Prop | Type | Description |
|---|---|---|
children | React.ReactNode | Required. The paper card content to print. |
onPrint | () => Promise<void> | void | Optional. Async callback executed while printing. Animation stays active until promise resolves (or minimum minDuration). |
status | PrinterStatus | Optional. Controlled status override: "idle" | "printing" | "done" | "error". |
minDuration | number | Optional. Minimum print duration in milliseconds for tactile realism. Default: 2600. |
size | "sm" | "md" | "lg" | Optional. Chassis size scale. Default: "md". |
buttonLabel | string | Optional. Label on the main chassis push button. Default: "Print". |
showActions | boolean | Optional. Displays the clean receipt action toolbar (Copy and Retract) attached below the paper when printing completes. Default: true. |
onCopyImage | () => void | Optional. Custom clipboard copy handler. By default, copies the receipt text contents to the user's clipboard with active feedback. |
onDownload | () => void | Optional. Custom callback for external PDF, export, or print handling if desired by the consumer. |
soundEnabled | boolean | Optional. Enables Web Audio sound synthesis. Default: true. |
soundVolume | number | Optional. Master audio volume (0 to 1). Default: 0.35. |
ref | React.Ref<PrinterRef> | Optional. Imperative control ref exposing .print(), .reset(), .getStatus(), .tear(), .jam(), and .unlockSound(). |