Coupon Apply

A checkout order summary rejects one coupon, accepts another and the total drops. A free, MIT-licensed Remotion product scene.

Installation
$ pnpm dlx shadcn@latest add @remocn/coupon-apply

Usage

tsx
// src/Root.tsx
import { Composition } from "remotion";
import { CouponApply } from "@/components/remocn/coupon-apply";
 
const CouponApplyScene = () => (
  <CouponApply merchant="Orbit" code="WELCOME20" invalidCode="WELCOME" percentOff={20} />
);
 
export const RemotionRoot = () => (
  <Composition
    id="CouponApply"
    component={CouponApplyScene}
    durationInFrames={360}
    fps={60}
    width={1280}
    height={720}
  />
);

An order summary and a payment form appear side by side. A cursor types a code that is rejected with a shake, retypes a valid one, the discount chip lands, the old total is struck through and the new total rolls in before the pay button lights up. Pass merchant, items (name, detail, amount), invalidCode, code and percentOff. The theme prop ships light and dark.

The ground is a live gradients.sh shader (GshGround), installed with the component as @remocn/gsh. Pick another look with the ground preset prop.

Props22

PropTypeDefault
merchant
string"Lumen"

Merchant name shown at the top of the order summary.

items
CouponLineItem[]DEFAULT_ITEMS

Order line items with name, detail and numeric amount.

invalidCode
string"LAUNCH"

First attempt, rejected with a shake. Set to "" to skip the invalid beat.

code
string"LAUNCH24"

Code that works. If it starts with `invalidCode`, only the rest is typed on retry.

percentOff
number10

Discount percentage applied to the subtotal.

currency
string"$"

Currency symbol placed before amounts.

payLabel
string"Subscribe"

Text on the pay button.

email
string"maya@kitebase.com"

Email address shown in the payment form.

cardholder
string"Maya Chen"

Cardholder name shown in the payment form.

formTitle
string"Pay with card"

Heading of the payment column.

placeholder
string"Add promotion code"

Placeholder in the empty promo field.

errorLabel
string"That code isn’t valid."

Message under the field when the first code is rejected.

theme
"light" | "dark""light"

Light or dark checkout styling.

accent
string"#3B5BFD"

Accent color for the pay button and focus states.

ink
string—

Text color; overrides the theme ink.

fontFamily
string"Instrument Sans"

Typeface for the copy. Load the font in your project first.

scale
number1

Size of the foreground around the frame's center; the background stays put.

delay
number0

Frames to hold the first frame before anything moves.

speed
number1

Playback speed multiplier for the whole timeline.

ground
GshPresetId—

Preset id for the shader background.

background
string—

Solid fill in place of the gradient ground; pass "transparent" to drop it.

groundParams
Partial<GradientParams>—

Overrides for the shader background parameters.

  • merchantstring

    Merchant name shown at the top of the order summary.

    Default"Lumen"

  • itemsCouponLineItem[]

    Order line items with name, detail and numeric amount.

    DefaultDEFAULT_ITEMS

  • invalidCodestring

    First attempt, rejected with a shake. Set to "" to skip the invalid beat.

    Default"LAUNCH"

  • codestring

    Code that works. If it starts with `invalidCode`, only the rest is typed on retry.

    Default"LAUNCH24"

  • percentOffnumber

    Discount percentage applied to the subtotal.

    Default10

  • currencystring

    Currency symbol placed before amounts.

    Default"$"

  • payLabelstring

    Text on the pay button.

    Default"Subscribe"

  • emailstring

    Email address shown in the payment form.

    Default"maya@kitebase.com"

  • cardholderstring

    Cardholder name shown in the payment form.

    Default"Maya Chen"

  • formTitlestring

    Heading of the payment column.

    Default"Pay with card"

  • placeholderstring

    Placeholder in the empty promo field.

    Default"Add promotion code"

  • errorLabelstring

    Message under the field when the first code is rejected.

    Default"That code isn’t valid."

  • theme"light" | "dark"

    Light or dark checkout styling.

    Default"light"

  • accentstring

    Accent color for the pay button and focus states.

    Default"#3B5BFD"

  • inkstring

    Text color; overrides the theme ink.

  • fontFamilystring

    Typeface for the copy. Load the font in your project first.

    Default"Instrument Sans"

  • scalenumber

    Size of the foreground around the frame's center; the background stays put.

    Default1

  • delaynumber

    Frames to hold the first frame before anything moves.

    Default0

  • speednumber

    Playback speed multiplier for the whole timeline.

    Default1

  • groundGshPresetId

    Preset id for the shader background.

  • backgroundstring

    Solid fill in place of the gradient ground; pass "transparent" to drop it.

  • groundParamsPartial<GradientParams>

    Overrides for the shader background parameters.