Billing Cart Mini
A small cart preview for showing selected plans and add-ons before checkout. Line items scroll inside a fixed-height list, a running subtotal sits above the checkout button, and an optional secondary link sends people back to browsing. Built for sidebar overlays and sticky headers where a full cart page would be overkill.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge, button, scroll-area dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-cart-mini.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing31.tsx instead.
Usage
The file also exports billing31Demo, 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 { Billing31, billing31Demo } from "@/components/blocks/billing/billing31"; export default function Page() { return <Billing31 {...billing31Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | "Your cart" | Heading shown in the header, next to the item count badge. |
| items | CartLineItem[] | none | Line items rendered in the order given. An empty array shows a plain empty-cart message instead of the list. |
| subtotalLabel | string | "Subtotal" | Label for the running total row above the checkout button. |
| subtotal | string | none | Preformatted subtotal amount, for example "$67.00". |
| checkoutLabel | string | "Checkout" | Label for the primary checkout button. |
| checkoutHref | string | none | Destination for the checkout button, rendered as a next/link. |
| continueShoppingLabel | string | "Continue browsing" | Label for the optional secondary link. |
| continueShoppingHref | string | none | When set, renders a secondary link below the checkout button. |
| className | string | none | Extra classes for the outer container. |
Types
interface CartLineItem { id: string; name: string; description?: string; price: string; period?: string; // e.g. "/mo" or "once" quantity?: number; }
Behavior notes
- The item list sits inside a ScrollArea capped at max-h-72, so it scrolls internally once there are more items than fit rather than growing the whole block.
- Quantity is only shown as a "2x" prefix on the item name when quantity is greater than 1; there's no built-in increment or decrement control.
- The subtotal and every line item price are plain strings, so currency formatting, rounding, and totals math are entirely up to the caller.
- Both the checkout and continue-browsing actions render as next/link, not buttons with onClick handlers, matching this category's other href-driven blocks.
- An empty items array replaces the list with a centered "Your cart is empty" message; the checkout button still renders underneath it.
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.