# Coupon pricing

A pricing card whose yearly discount tears off as a coupon.

Also called: pricing toggle, monthly yearly toggle, pricing card.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: A discount you can see. Pick Yearly and a perforated coupon tears off the billing control and sticks to the card as the price rolls down; Monthly peels it back. Preview: https://chatcn.dev/preview/coupon-pricing-demo

Pick Yearly and a perforated coupon tears off the end of the billing control along a jagged edge, lifts, and slaps onto the card like a sticker. Pick Monthly and it peels back off and seals onto its stub again. The price rolls like an odometer, a digit at a time, counting down to the yearly price and back up, and the billing line under it swaps with a blur.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/coupon-pricing
```

## Usage

```tsx
import { CouponPricing } from "@/components/ui/chatcn/pro/coupon-pricing"

<CouponPricing
  plan="Pro"
  price={{ monthly: 42, yearly: 35 }}
  coupon={{ title: "2 months free", detail: "Save $84" }}
  features={features}
/>
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `plan` / `tagline` | `ReactNode` |  |
| `price` | `{ monthly, yearly }` | Whole numbers |
| `coupon` | `{ title, detail? }` |  |
| `billed` | `{ monthly, yearly }` | Lines under the price |
| `features` / `cta` / `onCta` |  |  |
| `yearly` / `defaultYearly` / `onYearlyChange` | `boolean` |  |

## Accessibility

- The billing control is two pressed state buttons; the price is read as one number.

## Motion

- The tear and slap take about a second on keyframes with a back ease; the reels blur with their speed. Reduced motion: the coupon moves without the flight.

Source: https://chatcn.dev/docs/components/coupon-pricing