Animated credit usage card with period tabs, stacked breakdown, daily chart and plan limits.
Set your access key from API keys as NEXTUI_TOKEN in .env.local and add the @nextui namespace below to components.json once. Then every item installs by name. Each install counts as a copy on a free account.
$pnpm dlx shadcn@latest add @nextui/usage-card
1{2"registries": {3"@nextui": {4"url": "https://nextui.dev/r/{name}.json",5"headers": { "Authorization": "Bearer ${NEXTUI_TOKEN}" }6}7}8}
1"use client";23import { UsageCard } from "@/components/blocks/usage-card";45export function Billing() {6return (7<UsageCard8name="Northwind"9planLabel="Team plan · Resets in 4 days"10limit={20_000}11periods={{12month: {13label: "This month",14total: 12_400,15sources: [16{ name: "Chat", credits: 8_000 },17{ name: "API", credits: 4_400 },18],19days: [400, 520, 610, 380, 450],20slots: 30,21dayLabel: (i) => `Nov ${i + 1}`,22seats: 6,23storage: 1.4,24projects: 9,25},26}}27onUpgrade={() => location.assign("/billing")}28/>29);30}
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | "Acme AI" | Workspace or product name in the header |
| planLabel | string | "Pro plan · Resets in 9 days" | Muted line under the name |
| periods | Record<string, UsagePeriod> | This month, Last month, 7 days | Tabs keyed by id: totals, sources, daily credits and limits used |
| period | string | – | Controlled selected period id |
| defaultPeriod | string | first key | Period selected on first render |
| onPeriodChange | (period: string) => void | – | A tab was clicked |
| limit | number | 10000 | Credit allowance the bar and percentage use |
| seatLimit | number | 10 | Seats allowed |
| storageLimit | number | 5 | Storage allowed, in GB |
| shades | Record<string, string> | Chat, Search, Image, API | Tailwind background class per source name |
| upgradeLabel | string | "Upgrade" | Footer button while under the limit |
| addCreditsLabel | string | "Add credits" | Footer button once the limit is reached |
| onUpgrade | () => void | – | Upgrade was clicked |
| onAddCredits | () => void | – | Add credits was clicked |
| className | string | – | Extra classes on the section |
Sign in to see the code
Preview it freely. A free account copies code and prompts a few times a day.