Component packs › Ledger › 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.
| Prop | Type | Default | Description |
|---|---|---|---|
items | { label: string; amount: number }[] | Order lines: label and whole-unit amount. | |
coupons | Coupon[] | ||
currency | string | ||
label | string | ||
dark | boolean | ||
onApply | (c: Coupon | null) => void | ||
autoplay | number | false | Showcase mode: tries a wrong code, then a right one, then removes it, every N ms. |
apply(code: string): booleanremove(): voiddestroy(): voidimport CouponField from './CouponField';
<CouponField />The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.
Good for: Pricing and payment.