"use client";
import { CheckoutReceiptMorph } from "@/components/CheckoutReceiptMorph";
export default function Pay() {
// Production: Stripe Elements sit in the renderCardFields slot, so card numbers never touch your code.
return (
<CheckoutReceiptMorph
renderCardFields={(slot) => <div className={slot.fieldClassName}><CardElement onChange={(e) => slot.onChange({ complete: e.complete, brand: e.brand })} /></div>}
onConfirm={async ({ name }) => confirmWithStripe(name)} // stripe.confirmCardPayment, resolve { ok: true }
onComplete={(receipt) => console.log(receipt)}
/>
);
}
Receipt checkout in a shadcn or UI-kit app: scope the stylesheet
checkout-receipt-morph.css ships as a full-page stylesheet, and in a shadcn or other Tailwind UI-kit app it reaches past the checkout. Nothing in it is in a cascade layer. It sets 34 variables on :root, --muted and --font-mono among them, gives html and body a near-black background and Space Grotesk, resets every button and input, and restyles every h1 and h2 on the page.
Tailwind v4 puts shadcn's styles in cascade layers, so these unlayered rules win. On our shadcn test page with the file imported as shipped, the body went from white to #0A0A0D, Buttons went from 14px at weight 500 to 16px at 400, Inputs from 14px to 16px, and the page h1 grew from 24px to 26px with its bottom margin cut from 24px to 4px. bg-muted turned #9AA0B4.
The edits below keep it inside the checkout. In your copy of the CSS, remove the 11 html:not(.fit) prefixes, change :root{ and html,body{ to :scope{, and wrap everything in @scope (.qd-rcpt). The h1, h2, button and input rules then only touch the checkout. Add the preflight rule to globals.css, because the piece was built with Tailwind's preflight off, and wrap the component in a div with the class qd-rcpt. Putting the class on the component's own className doesn't work: inside @scope a class selector skips the scope root, so its .root rule stopped matching in our test.
@keyframes shake kept working inside @scope in all three engines we ran. Keyframe names are still global, so if your app already has a keyframe called shake, rename the piece's one and the one animation line that uses it (.rig.err .c3d). Stripe's card fields live in Stripe's iframes, so neither version of the file styles the digits; the .inp boxes around them are styled as before.
Measured on October 25, 2026 with the zip's static HTML checkout on our shadcn test page (Tailwind 4.3.3; headless Chromium 156, Firefox 157 and WebKit 27.2; 1440 and 390 px): the shadcn elements matched the page without the checkout apart from the body's height, --muted stayed shadcn's, and all 121 checkout elements matched the checkout alone with preflight off. We didn't run the React component in Next.js or with live Stripe Elements, and Playwright's WebKit isn't Safari.
@scope is in Chrome and Edge 118+, Safari 17.4+ and Firefox 146+ (caniuse data read October 25, 2026). An older browser ignores the whole block and the checkout shows unstyled. For those, skip @scope and put .qd-rcpt in front of every selector, using .qd-rcpt where :root and html,body were. That version we haven't measured.
components/checkout-receipt-morph.css (the edits)
/* components/checkout-receipt-morph.css (your copy from the zip). Three edits. */
/* 1. Find "html:not(.fit) " and replace it with nothing.
It appears 11 times, all inside the max-width: 760px block. */
/* 2. Change ":root{" to ":scope{" and "html,body{" to ":scope{". */
/* 3. Wrap the whole file in one @scope block. The h1, h2, button and
input rules and @keyframes shake can stay where they are inside it. */
@scope (.qd-rcpt) {
/* ...the file as shipped, with edits 1 and 2... */
}
app/globals.css (the added rule)
/* app/globals.css: add below shadcn's theme and @layer base.
Receipt Morph was built with Tailwind's preflight off. This rolls preflight
and shadcn's base layer back inside .qd-rcpt only; your pages keep both. */
@layer base {
.qd-rcpt, .qd-rcpt :where(*) { all: revert-layer; }
.qd-rcpt { line-height: normal; }
}
app/pay/page.tsx
"use client";
import { CheckoutReceiptMorph } from "@/components/CheckoutReceiptMorph";
export default function Pay() {
// qd-rcpt on a wrapper div, not on the component's className.
return (
<div className="qd-rcpt">
<CheckoutReceiptMorph
renderCardFields={(slot) => <div className={slot.fieldClassName}><CardElement onChange={(e) => slot.onChange({ complete: e.complete, brand: e.brand })} /></div>}
onConfirm={async ({ name }) => confirmWithStripe(name)}
/>
</div>
);
}
Install
Copy from the zipPut react/src/components + react/src/data into src/, then npm i framer-motion.
Or ask your AIPaste PROMPT.md into Cursor, Lovable or v0.
Props
order
line items and totals
renderCardFields
Stripe Elements inside the design
onConfirm
confirm with Stripe, resolve { ok: true }
onComplete
the stamped receipt
How qodesign compares
qodesign vs 21st.dev21st.dev is best for: browsing a huge marketplace and copying many components a month.
qodesign vs Skiper UISkiper UI is best for: unusual interaction details for landing pages: image reveals, cursor trails, tooltips, drag-and-scroll galleries.
All comparisons, with prices read on each library's own site.
As shipped, yes. The file makes your body dark, changes --muted, Button and Input text sizes, and your h1 and h2 headings. With the @scope edits, the globals.css rule and the qd-rcpt wrapper above, our shadcn test page kept its own styles and the checkout kept its look.
Does the checkout work in Next.js?
Yes, as a client component. Keep "use client" at the top of the file that renders it, as in the snippet above. App Router and Pages Router both work.
Can I use it with Stripe?
Yes. Put Stripe Elements in the renderCardFields slot and confirm the payment in onConfirm. Card numbers go straight to Stripe and never reach your server. The README has the full wiring.
Can Cursor or v0 add it for me?
Yes. Each download has a PROMPT.md. Paste it into Cursor, Lovable, v0 or Claude Code and it fits the piece into your app.
Can I use it in client work?
Yes, in personal and client projects. You can't resell the code itself as a kit.