Usage Card
billui/usage-cardFreeComponent
A card for displaying usage metrics, billing cycle progress and itemized charges.
Live preview
live · rendered by the registry
Rendered by billui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://billui.com/r/usage-card.jsonSource
1"use client";23import { cva, type VariantProps } from "class-variance-authority";4import { ChevronDown, ChevronUp } from "lucide-react";5import * as React from "react";6import { Button } from "@/components/ui/button";7import { Progress } from "@/components/ui/progress";8import { cn } from "@/lib/utils";910const usageCardVariants = cva(11 "relative min-w-[280px] rounded-2xl border bg-card text-card-foreground",12 {13 variants: {14 variant: {15 default: "border-border",16 elevated: "border-border shadow-lg",17 },18 },19 defaultVariants: {20 variant: "default",21 },22 },23);2425interface UsageCardProps26 extends React.HTMLAttributes<HTMLDivElement>,27 VariantProps<typeof usageCardVariants> {}2829const UsageCard = React.forwardRef<HTMLDivElement, UsageCardProps>(30 ({ className, variant, ...props }, ref) => (31 <div32 ref={ref}33 className={cn(usageCardVariants({ variant, className }))}34 {...props}35 />36 ),37);38UsageCard.displayName = "UsageCard";3940interface UsageCardHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}4142const UsageCardHeader = React.forwardRef<HTMLDivElement, UsageCardHeaderProps>(43 ({ className, ...props }, ref) => (44 <div45 ref={ref}46 className={cn(47 "flex items-center justify-between gap-4 p-4 pb-0",48 className,49 )}50 {...props}51 />52 ),53);54UsageCardHeader.displayName = "UsageCardHeader";5556interface UsageCardPeriodProps extends React.HTMLAttributes<HTMLSpanElement> {57 daysRemaining?: number;58}5960const UsageCardPeriod = React.forwardRef<HTMLSpanElement, UsageCardPeriodProps>(61 ({ className, daysRemaining, children, ...props }, ref) => (62 <span63 ref={ref}64 className={cn("text-sm font-medium text-foreground", className)}65 {...props}66 >67 {children ??68 (daysRemaining !== undefined &&69 `${daysRemaining} days remaining in cycle`)}70 </span>71 ),72);73UsageCardPeriod.displayName = "UsageCardPeriod";7475interface UsageCardActionProps76 extends React.ComponentPropsWithoutRef<typeof Button> {}7778const UsageCardAction = React.forwardRef<79 HTMLButtonElement,80 UsageCardActionProps81>(({ className, ...props }, ref) => (82 <Button83 ref={ref}84 variant="outline"85 size="sm"86 className={cn("rounded-full", className)}87 {...props}88 />89));90UsageCardAction.displayName = "UsageCardAction";9192interface UsageCardSummaryProps extends React.HTMLAttributes<HTMLDivElement> {}9394const UsageCardSummary = React.forwardRef<95// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from billui
All 13 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Usage Cardanimated-usage-card | billui | Components | Free | 2 deps | |
| Billing Addressbilling-address | billui | Components | Free | no deps | |
| Card Iconscard-icons | billui | Components | Free | 1 dep | |
| Card Inputcard-input | billui | Components | Free | no deps | |
| Invoice Cardinvoice-card | billui | Components | Free | 2 deps | |
| Payment Methodpayment-method | billui | Components | Free | 2 deps | |
| Plan Cardplan-card | billui | Components | Free | 2 deps | |
| Plan Groupplan-group | billui | Components | Free | 1 dep |
