Finance
Return on Assets Card - Asset Returns
Monitor return on assets and asset profitability. Track ROA metrics and efficiency.
Finance ROA Card
The Finance ROA Card displays Return on Assets metrics, measuring how efficiently a company uses its assets to generate profit.
Preview
Installation
npx shadcn@latest add https://vectormotion.vercel.app/registry/finance-roa-card.jsonFinance ROA Card
'use client'import React from 'react';import { TrendingUp, BarChart } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx"import { twMerge } from "tailwind-merge"import { ResponsiveContainer, RadialBarChart, RadialBar, PolarAngleAxis } from 'recharts';function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs))}interface ROAData { name: string; value: number; fill: string; [key: string]: any;}interface ROACardProps { isInteractive?: boolean; className?: string; title?: string; roaLabel?: string; roaChange?: string; efficiencyLabel?: string; efficiencyStatus?: string; netIncomeLabel?: string; assetsLabel?: string; data?: ROAData[];}const DEFAULT_TITLE = "ROA";const DEFAULT_ROA_LABEL = "8.5%";const DEFAULT_ROA_CHANGE = "+1.2%";const DEFAULT_EFFICIENCY_LABEL = "Efficiency";const DEFAULT_EFFICIENCY_STATUS = "Strong";const DEFAULT_NET_INCOME_LABEL = "Net Income: $85k";const DEFAULT_ASSETS_LABEL = "Assets: $1M";const DEFAULT_DATA: ROAData[] = [{ name: 'ROA', value: 8.5, fill: '#10b981' }];export const ROACard: React.FC<ROACardProps> = ({ isInteractive = true, className = "", title = DEFAULT_TITLE, roaLabel = DEFAULT_ROA_LABEL, roaChange = DEFAULT_ROA_CHANGE, efficiencyLabel = DEFAULT_EFFICIENCY_LABEL, efficiencyStatus = DEFAULT_EFFICIENCY_STATUS, netIncomeLabel = DEFAULT_NET_INCOME_LABEL, assetsLabel = DEFAULT_ASSETS_LABEL, data = DEFAULT_DATA,}) => { const index = 37; 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">{roaLabel}</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" /> {roaChange} </span> </div> </div> <div className="rounded-lg bg-emerald-500/10 p-2 text-emerald-500"> <BarChart className="h-5 w-5" /> </div> </div> <div className="relative z-10 flex-1 min-h-[120px] flex items-center justify-center"> <div className="h-[120px] w-full relative"> <ResponsiveContainer width="100%" height="100%"> <RadialBarChart cx="50%" cy="50%" innerRadius="60%" outerRadius="90%" barSize={12} data={data} startAngle={180} endAngle={0} > <PolarAngleAxis type="number" domain={[0, 15]} angleAxisId={0} tick={false} /> <RadialBar background={{ fill: '#f4f4f5' }} // zinc-100 dataKey="value" cornerRadius={10} /> </RadialBarChart> </ResponsiveContainer> <div className="absolute inset-0 flex flex-col items-center justify-center pointer-events-none pb-4"> <span className="text-xs text-muted-foreground">{efficiencyLabel}</span> <span className="font-bold text-foreground">{efficiencyStatus}</span> </div> </div> </div> <div className="z-10 mt-2 flex items-center justify-between text-xs pt-2 border-t border-border"> <span>{netIncomeLabel}</span> <span className="text-muted-foreground">{assetsLabel}</span> </div> </motion.div> );};Props
Prop
Type
Usage
This component is a demo card displaying ROA metrics with animated visualizations and dark mode support.