Aadarsh

Receipt Printer

Component 32

About

An interactive receipt printer with tactile paper tearing and optional sound.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Receipt Printer to your project and fits it to your theme.

Code

How Receipt Printer is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { useRef } from "react";
import ReceiptPrinter, { type ReceiptPrinterHandle } from "@/components/ui/receipt-printer";

export default function ReceiptPrinterDemo() {
  const printerRef = useRef<ReceiptPrinterHandle>(null);

  return (
    <main className="flex min-h-screen flex-col items-center justify-center gap-8 bg-white p-8 text-slate-950 dark:bg-slate-950 dark:text-white">
      <ReceiptPrinter ref={printerRef} />
      <button
        className="rounded-full bg-slate-900 px-5 py-3 text-sm font-medium text-white shadow-sm transition hover:bg-slate-700 dark:bg-white dark:text-slate-950 dark:hover:bg-slate-200"
        type="button"
        onClick={() => printerRef.current?.open()}
      >
        Print receipt
      </button>
    </main>
  );
}

More by Aadarsh

View all
  • Agent Id

    Agent Id

    31