Billing Data Retention Plan
A data retention management block for compliance-heavy settings pages. Selecting a plan updates the retention period and the storage capacity bar underneath it, and a separate switch controls whether old data is deleted automatically once it passes the selected plan's retention window. Built with TypeScript, Tailwind CSS, and Lucide icons.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-data-retention-plan.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing45.tsx instead.
Usage
The file also exports billing45Demo, 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 { Billing45, billing45Demo } from "@/components/blocks/billing/billing45"; export default function Page() { return <Billing45 {...billing45Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Data retention" | Block heading. |
| description | string | none | Supporting text under the heading. |
| plans | RetentionPlan[] | none | Retention plans rendered as selectable cards, in the order given. |
| currentUsageGB | number | none | Current storage usage in GB, compared against the selected plan's limit. |
| defaultPlanId | string | plans[0].id | Which plan is selected on first render. |
| autoCleanupDefault | boolean | true | Whether the automated cleanup switch starts on. |
| className | string | none | Extra classes for the outer container. |
Types
interface RetentionPlan { id: string; name: string; days: number; storageLimitGB: number; badge?: string; }
Behavior notes
- Selected plan and the automated cleanup switch are both local state, seeded from defaultPlanId and autoCleanupDefault.
- The storage capacity bar always reflects currentUsageGB against the currently selected plan's storageLimitGB, so switching plans instantly moves the bar even though usage itself hasn't changed.
- The bar turns amber once usage reaches 90% of the selected plan's limit, it doesn't block selection or show a hard error at 100%.
- The automated cleanup switch is a real role="switch" button with aria-checked, not a checkbox input, and its helper text below it changes between the two states using the selected plan's day count.
- Plan cards are buttons in a radiogroup, so switching plans works with keyboard navigation and screen readers, not only 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.