Finance
Working Capital Card - Operating Capital
Monitor working capital and operational funding. Track current assets and short-term financial health.
Finance Working Capital Card
The Finance Working Capital Card displays working capital metrics, measuring the company's operational liquidity and short-term financial health.
Preview
Installation
npx shadcn@latest add https://vectormotion.vercel.app/registry/finance-working-capital-card.jsonFinance Working Capital Card
'use client'import React from 'react';import { Briefcase, TrendingUp } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx"import { twMerge } from "tailwind-merge"import { ResponsiveContainer, BarChart, Bar, XAxis, Tooltip, Cell } from 'recharts';function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs))}interface CapitalData { name: string; value: number; [key: string]: any;}interface WorkingCapitalCardProps { isInteractive?: boolean; className?: string; title?: string; assets?: number; liabilities?: number; data?: CapitalData[]; healthStatus?: string; ratioLabel?: string;}const DEFAULT_TITLE = "Working Capital";const DEFAULT_ASSETS = 150000;const DEFAULT_LIABILITIES = 95000;const DEFAULT_DATA: CapitalData[] = [ { name: 'Assets', value: 150000 }, { name: 'Liab', value: 95000 },];const DEFAULT_HEALTH_STATUS = "Healthy";const DEFAULT_RATIO_LABEL = "Current Ratio";export const WorkingCapitalCard: React.FC<WorkingCapitalCardProps> = ({ isInteractive = true, className = "", title = DEFAULT_TITLE, assets = DEFAULT_ASSETS, liabilities = DEFAULT_LIABILITIES, data = DEFAULT_DATA, healthStatus = DEFAULT_HEALTH_STATUS, ratioLabel = DEFAULT_RATIO_LABEL,}) => { const workingCapital = assets - liabilities; const ratio = (assets / liabilities).toFixed(2); const index = 21; return ( <motion.div layoutId={isInteractive ? `card-${index}-${title}` : undefined} transition={{ duration: 0.4, ease: "easeOut" }} className={cn( "relative overflow-hidden rounded-xl border border-border bg-card text-card-foreground p-5 shadow-sm transition-all flex flex-col h-full group", isInteractive ? "cursor-pointer hover:border-primary/50 hover:shadow-md" : "", className )} > <div className="mb-2 flex items-start justify-between relative z-10"> <div> <h3 className="font-semibold text-lg text-foreground"> {title} </h3> <div className="flex items-center gap-2 mt-1"> <span className="text-2xl font-bold text-foreground">${(workingCapital / 1000).toFixed(1)}k</span> <span className="text-xs text-emerald-600 bg-emerald-500/10 px-1.5 py-0.5 rounded-full flex items-center gap-0.5"> <TrendingUp className="w-3 h-3" /> {healthStatus} </span> </div> </div> <div className="rounded-lg bg-emerald-500/10 p-2 text-emerald-500"> <Briefcase className="h-5 w-5" /> </div> </div> <div className="relative z-10 flex-1 min-h-[140px]"> <div className="absolute inset-0"> <ResponsiveContainer width="100%" height="100%"> <BarChart data={data}> <Tooltip cursor={{ fill: 'transparent' }} contentStyle={{ backgroundColor: 'var(--tooltip-bg)', borderRadius: '8px', border: 'none', color: 'var(--tooltip-text)' }} formatter={(value: number) => [`$${value.toLocaleString()}`, '']} /> <XAxis dataKey="name" axisLine={false} tickLine={false} tick={{ fontSize: 10, fill: '#71717a' }} /> <Bar dataKey="value" radius={[4, 4, 0, 0]} barSize={40} animationDuration={1500} > <Cell fill="#10b981" /> <Cell fill="#ef4444" /> </Bar> </BarChart> </ResponsiveContainer> </div> </div> <div className="z-10 mt-2 flex items-center justify-between text-xs pt-2 border-t border-border"> <span className="text-muted-foreground">{ratioLabel}</span> <span className="font-bold text-foreground">{ratio}</span> </div> </motion.div> );};Props
Prop
Type
Usage
This component is a demo card displaying working capital data with animated visualizations and dark mode support.