Animated React button components

Receipt button

A pay button that turns into a receipt printer: progress fill, check draw, line-by-line paper feed and a torn-off receipt.

Buttons, press, then a timeline, GSAP

Install

npm i @gsap/react clsx gsap tailwind-merge && curl -o components/receipt-button.tsx https://motion-brew.com/r/receipt-button.tsx

One self contained file for React and Tailwind CSS: receipt-button.tsx. Or ask your AI agent to add it through the MCP server.

Usage

import { ReceiptButton } from "@/components/receipt-button";

export default function Page() {
  return (
    <ReceiptButton
      currency="€"
      merchant="CORNER BAKERY"
      items={[
        { qty: 2, name: "Sourdough", price: 4.5 },
        { qty: 1, name: "Rye loaf", price: 5.2 },
      ]}
      onPay={() => charge()}
    />
  );
}

Props

PropTypeDefaultDescription
itemsReceiptItem[]3 café items{ qty, name, price } rows; the total is their sum
currencystring"
quot;
Currency symbol
merchantstring"NORTH ROAST"Shop name
taglinestring"Coffee bar"Line under the shop name
orderIdstring"1042"Order number; also seeds the barcode
footerstring"Thank you, come again"Last line
labelReactNodePay {total}Button label before paying
paidLabelstring"Paid"Label once paid
processingnumber1200Processing fill length, ms
feedSpeednumber0.09Seconds per printed line
colorstring"#141414"Button color before paying
successColorstring"#2f8a4f"Fill and paid color
resetAfternumber \null3200Reset delay after the tear, ms; null keeps the receipt
onPay() => voidPayment started
onComplete() => voidReceipt torn off

More buttons

  • Fuse button: An action button whose done state carries an undo on a burning fuse.
  • Magnetic button: A button that leans toward your cursor on a spring.
  • Hold to confirm: Hold to fill, let go to cancel.
  • Bell toggle: A pill toggle where a press rings the bell, crossfades the label and unfurls the pill.

All animated react button components