Billing Grace Period Countdown
An alert block for accounts with a failed payment that are still in a grace period before access is cut off. It shows days and hours remaining, a bar showing how much of the grace window has elapsed, and a resolve-payment button. Once the countdown reaches zero it swaps to a suspended-access state with a different message and a restore-access button.
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-grace-period-countdown.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing63.tsx instead.
Usage
The file also exports billing63Demo, 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 { Billing63, billing63Demo } from "@/components/blocks/billing/billing63"; export default function Page() { return <Billing63 {...billing63Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Your account is in a grace period" | Heading shown while the grace period is still active. |
| message | string | none | Supporting sentence shown under the heading while active. |
| daysRemaining | number | none | Whole days left in the grace period. Combine with hoursRemaining for the full remaining time. |
| hoursRemaining | number | 0 | Additional hours left beyond daysRemaining. |
| totalGraceDays | number | none | The full length of the grace period; when set, renders a progress bar showing how much time is left. |
| amountDue | string | none | Optional formatted amount shown under the countdown. |
| resolveLabel | string | "Update payment method" | Label on the action button while the grace period is active. |
| resolveHref | string | none | Destination for the action button. |
| suspendedHeading | string | "Access suspended" | Heading shown once the countdown reaches zero. |
| suspendedMessage | string | (see source) | Message shown once the countdown reaches zero. |
| className | string | none | Extra classes for the outer alert container. |
Behavior notes
- daysRemaining and hoursRemaining are plain numbers you compute server-side or on each page load from your own grace-period-end timestamp; the component never reads the clock itself, so there's no client/server render mismatch.
- The suspended state activates when both daysRemaining and hoursRemaining are zero or less, swapping the heading, message, icon, and button label without any additional prop.
- The optional progress bar only renders when totalGraceDays is passed; it shows the remaining fraction of the grace window, not the elapsed fraction.
- The action button is a plain anchor rendered through the Button component's render prop, so resolveHref can point straight at your payment update page.
- This component has no internal timer. If you want it to visibly count down while the page is open, recompute daysRemaining and hoursRemaining on an interval in the parent and pass fresh values down as props.
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.