Subscription Status

Six states, each with the date it depends on, and cancelled is not expired.

PROGet Subscription Status and 168 other Pro components with pro lifetime — Get Pro

Category
Billing
Access
Pro
Source
509 lines · one file

The decision inside it

Cancelled is amber, expired is red

A cancelled plan still works until the end of the period; an expired one does not. Drawing both in red tells a customer who can still use everything that they have already lost it. The date each state depends on is required by the type, so a cancelled card without an end date does not compile.

When to use it

Use Subscription Status for the plan card on a billing page: the plan, price and the one fact that matters for its state (renews on, trial ends with or without a card, past due with a cutoff, cancelled until, paused, expired) with the right action. Prices are in cents.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Subscription Status for this.
Install it: npx shadcn@latest add @liro/subscription-status
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/subscription-status.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/plan-card.tsx
import { SubscriptionStatus } from "@/components/ui/subscription-status";

export function PlanCard({ manage }: { manage: () => void }) {
  return (
    <SubscriptionStatus
      plan={{ name: "Team", price: 8900, interval: "month", seats: 10 }}
      state={{ status: "trialing", trialEndsOn: "24 Oct", trialDaysLeft: 6, hasPaymentMethod: false }}
      onManage={manage}
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
stateSubscriptionState Yes–
planSubscriptionPlan Yes–
currencystring NoISO 4217, from the subscription — never from the viewer. Default `USD`.
localestring No–
titlestring No–
periodSubscriptionPeriod NoShow the period as a label/value grid with a progress bar. Only drawn while the period is live — active, trialing, cancelled — because a bar counting down days on an expired plan is counting down nothing.
onManage() => void NoActive: open the plan picker or billing page.
onUpdatePayment() => void NoTrialing without a card, and past due: open the payment method form.
onResume() => void NoCancelled and paused: undo it.
onChoosePlan() => void NoExpired: pick a plan to come back on.
lookLook NoLayered sets it in a tray, the heading above the card and the status in the strip below. Flat is one card.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themestatus-chip

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances