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
- ProPro · unlocked
- 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
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.
| Type | Notes | ||
|---|---|---|---|
state | SubscriptionState | Yes | – |
plan | SubscriptionPlan | Yes | – |
currency | string | No | ISO 4217, from the subscription — never from the viewer. Default `USD`. |
locale | string | No | – |
title | string | No | – |
period | SubscriptionPeriod | No | Show 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 | No | Active: open the plan picker or billing page. |
onUpdatePayment | () => void | No | Trialing without a card, and past due: open the payment method form. |
onResume | () => void | No | Cancelled and paused: undo it. |
onChoosePlan | () => void | No | Expired: pick a plan to come back on. |
look | Look | No | Layered 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-mergeLiro foundations, installed alongside it
liro-themestatus-chipAccessibility
- 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