Component packs › Ledger › Coupon Field

Coupon Field

A good code opens the discount line with its coins and turns the total down; a wrong one shakes the field and says what went wrong.

Coupon Field is a promo code from Ledger, a component pack with 6 pricing components: Pricing controls where every number turns on its own digit wheel and savings are a stack of coins. Price: $2 for the whole pack.

Built with: discount coins, rolling total, clear errors.

Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.

Coupon Field props

PropTypeDefaultDescription
items{ label: string; amount: number }[]Order lines: label and whole-unit amount.
couponsCoupon[]
currencystring
labelstring
darkboolean
onApply(c: Coupon | null) => void
autoplaynumber | falseShowcase mode: tries a wrong code, then a right one, then removes it, every N ms.

Methods on the ref

Use it in React

import CouponField from './CouponField';

<CouponField />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Ledger

Good for: Pricing and payment.