Invoice Card
A card for displaying invoice details and billing history.
INV-2024-001Paid
Jan 15, 2024INV-2024-002Pending
Feb 15, 2024INV-2024-003Failed
Mar 15, 2024Installation
npx shadcn@latest add "https://billui.com/r/invoice-card.json"import { cva, type VariantProps } from "class-variance-authority";
import { Download, ExternalLink, FileText } from "lucide-react";
import * as React from "react";
import { cn } from "@/lib/utils";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
const invoiceCardVariants = cva(
"relative flex items-center gap-4 rounded-xl border bg-card p-4 text-card-foreground transition-colors hover:bg-accent/50",
{
variants: {
variant: {
default: "border-border",
compact: "gap-3 p-3",
},
},
defaultVariants: {
variant: "default",
},
},
);
interface InvoiceCardProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof invoiceCardVariants> {}
const InvoiceCard = React.forwardRef<HTMLDivElement, InvoiceCardProps>(
({ className, variant, ...props }, ref) => (
<div
ref={ref}
className={cn(invoiceCardVariants({ variant, className }))}
{...props}
/>
),
);
InvoiceCard.displayName = "InvoiceCard";
// ... rest of component codeExamples
Pending Status
INV-2024-002Pending
Feb 15, 2024Failed Status
INV-2024-003Failed
Mar 15, 2024Refunded Status
INV-2024-004Refunded
Apr 15, 2024Draft Status
INV-2024-005Draft
May 15, 2024Compact Variant
Use the compact variant for denser layouts.
INV-2024-001Paid
Jan 15, 2024Long Date Format
Use the format="long" prop for more detailed date display.
INV-2024-001Paid
January 15, 2024With Actions
Include download or view action buttons.
INV-2024-001Paid
Jan 15, 2024Custom Currency
Display amounts in different currencies.
INV-2024-001Paid
Jan 15, 2024API Reference
InvoiceCard
The root container component.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "compact" | "default" |
InvoiceCardStatus
Badge showing the invoice status.
| Prop | Type | Default |
|---|---|---|
status | "paid" | "pending" | "failed" | "refunded" | "draft" | — |
InvoiceCardDate
Displays the invoice date.
| Prop | Type | Default |
|---|---|---|
date | Date | string | — |
format | "short" | "long" | "short" |
InvoiceCardAmount
Displays the invoice amount.
| Prop | Type | Default |
|---|---|---|
amount | number | — |
currency | string | "$" |
InvoiceCardAction
Action button for download or view.
| Prop | Type | Default |
|---|---|---|
action | "download" | "view" | "download" |