Billing Add On Bundle Pricing
A multi-select add-on list for upsell and checkout flows. Each add-on toggles on and off as a checkbox-style button, and the summary panel recalculates the subtotal, bundle discount, and total on every selection, applying a 10% discount at two items and 20% at three or more.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-add-on-bundle-pricing.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing14.tsx instead.
Usage
The file also exports billing14Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Billing14, billing14Demo } from "@/components/blocks/billing/billing14"; export default function Page() { return <Billing14 {...billing14Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Customize your plan" | Heading above the add-on list. |
| description | string | (see source) | Supporting sentence under the heading. |
| addOns | AddOnBundleItem[] | none | Add-ons rendered as selectable rows, in the order given. |
| defaultSelectedIds | string[] | [] | Ids selected on first render. |
| updateLabel | string | "Update bundle" | Label on the submit button. |
| className | string | none | Extra classes for the outer wrapper. |
Types
interface AddOnBundleItem { id: string; name: string; description?: string; price: number; }
Behavior notes
- Selection is local state; toggling an add-on adds or removes its id from selectedIds and immediately recalculates the summary.
- The discount rate is a fixed step function: 0% for one item, 10% for two, 20% for three or more. Change discountRateFor in billing14.tsx to match your own pricing rules.
- Subtotal, discount, and total are derived on every render from the selected add-ons, not stored as separate state, so they can never drift out of sync with the selection.
- The Update bundle button is disabled while no add-ons are selected, since there'd be nothing to submit.
- Each add-on row uses role="checkbox" and aria-checked, so selection works with keyboard and screen readers, not just pointer clicks.
Frequently asked questions
More Billing Blocks
View all →Billing Invoice List
Invoice history table with status badges, formatted amounts, and a per-row download link, built with shadcn/ui and Tailwind CSS.
Billing Failed Payment Alert
High-contrast failed-payment alert with a message, a retry button, and an optional update-payment-method button, built with shadcn/ui and Tailwind CSS.
Billing Credit Balance
Compact credit balance card with a large total, an optional purchased-versus-promotional breakdown, a low-balance notice, and a top-up button.
Billing Payment Methods
A saved payment method list for React and Next.js with brand icons, a default badge, near-expiry warnings, and remove/set-default actions per row.
Billing Add Card
A card entry form for React and Next.js with auto-formatted fields, internal brand detection, and per-field validation feedback built with shadcn/ui and Tailwind CSS.
Billing Coupon Code
An inline promo code input for React and Next.js with a simulated loading state, an applied summary showing the discount amount, and an invalid-code message.