Staaarter

Billing Trial Countdown

A trial countdown block that shows how much trial time is left, switching from a neutral tone to amber and then red as the deadline approaches, plus an optional usage breakdown for premium features used during the trial. Time remaining is passed in as plain numbers rather than computed from the current clock, so it renders identically on the server and after hydration.

By Staaarter Team
Billing
Updated May 19, 2026
Docs
Live preview

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-trial-countdown.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing143.tsx instead.

Usage

The file also exports billing143Demo, 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 { Billing143, billing143Demo } from "@/components/blocks/billing/billing143";

export default function Page() {
  return <Billing143 {...billing143Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Your trial"Heading shown next to the status icon.
descriptionstringnoneOptional supporting text under the heading.
daysRemainingnumbernoneWhole days left in the trial. Pass 0 on the final day and rely on hoursRemaining.
hoursRemainingnumbernoneHours left within the current day, shown alongside daysRemaining.
trialEndLabelstringnoneHuman-readable end date, e.g. "May 10, 2026", shown under the countdown.
usageItemsTrialUsageItem[]noneOptional list of premium features used during the trial, each rendered with a small progress bar.
expiredbooleanfalseWhen true, switches the block into its expired state regardless of daysRemaining.
upgradeHrefstring"#"Link target for the call-to-action button.
upgradeLabelstring"Unlock full access" / "Reactivate your account"Button label; defaults differ based on whether the trial is expired.
classNamestringnoneExtra classes for the outer container.

Types

interface TrialUsageItem {
  label: string;
  used: number;
  total: number;
}

Behavior notes

  • Time remaining is entirely prop-driven: the component does not call Date.now() or set up a timer. Recompute daysRemaining/hoursRemaining on the server (or in a parent client component) and pass fresh values down; this keeps the block SSR-safe and avoids hydration mismatches.
  • Urgency is derived purely from daysRemaining and the expired flag: normal above 2 days, amber at 2 days or fewer, red at 1 day or fewer or once expired.
  • When daysRemaining is 0, the headline switches to showing only hoursRemaining instead of "0 days".
  • The usage section and its progress bars only render when usageItems is a non-empty array.
  • In the expired state, the button label defaults to "Reactivate your account" instead of "Unlock full access", and the description below the countdown reads "ended" instead of "ends".

Frequently asked questions