Vector Motion
E-Commerce

Revenue Analytics Card - Financial Dashboard

Analyze revenue trends and financial performance. Track revenue streams and growth metrics.

Revenue Analytics Card

The Revenue Analytics Card Analyze revenue breakdown by sales channel with growth indicators.

Preview

Installation

ash npx shadcn@latest add https://vectormotion.vercel.app/registry/revenue-analytics-card.json

Revenue Analytics Card
'use client';import React from "react";import { BarChart3, TrendingUp } from "lucide-react";import { motion } from "motion/react";import { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";function cn(...inputs: ClassValue[]) {  return twMerge(clsx(inputs));}interface Channel {  name: string;  revenue: number;  percentage: number;  color: string;  [key: string]: any;}interface RevenueAnalyticsCardProps {  className?: string;  title?: string;  description?: string;  totalRevenue?: string;  revenueChange?: number;  channels?: Channel[];}const DEFAULT_TITLE = "Revenue Analytics";const DEFAULT_DESCRIPTION = "By Channel";const DEFAULT_TOTAL_REVENUE = "$100K";const DEFAULT_REVENUE_CHANGE = 8.2;const DEFAULT_CHANNELS: Channel[] = [  {    name: "Online Store",    revenue: 45000,    percentage: 45,    color: "bg-blue-500",  },  {    name: "Marketplace",    revenue: 30000,    percentage: 30,    color: "bg-purple-500",  },  {    name: "Mobile App",    revenue: 15000,    percentage: 15,    color: "bg-emerald-500",  },  {    name: "Wholesale",    revenue: 10000,    percentage: 10,    color: "bg-orange-500",  },];export const RevenueAnalyticsCard: React.FC<RevenueAnalyticsCardProps> = ({  className = "",  title = DEFAULT_TITLE,  description = DEFAULT_DESCRIPTION,  totalRevenue = DEFAULT_TOTAL_REVENUE,  revenueChange = DEFAULT_REVENUE_CHANGE,  channels = DEFAULT_CHANNELS,}) => {  const isInteractive = true;  const index = 2;  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-6 shadow-sm transition-all flex flex-col group",        isInteractive          ? "cursor-pointer hover:border-zinc-300 dark:hover:border-zinc-700"          : "",        className,      )}    >      <div className="mb-4 flex items-start justify-between relative z-10">        <div>          <h3 className="font-semibold text-lg tracking-tight text-foreground">            {title}          </h3>          {description && (            <p className="text-sm text-muted-foreground mt-1">{description}</p>          )}        </div>        <div className="rounded-full bg-zinc-100 dark:bg-zinc-800 p-2 text-foreground flex items-center justify-center">          <BarChart3 className="h-5 w-5 text-blue-500" />        </div>      </div>      <div className="relative z-10 flex-1">        <div className="text-3xl font-bold text-foreground mb-1">          {totalRevenue}        </div>        <div className="flex items-center gap-2 text-sm mb-4">          <TrendingUp className="h-4 w-4 text-emerald-500" />          <span className="text-emerald-500 font-medium">            +{revenueChange}%          </span>          <span className="text-muted-foreground">this month</span>        </div>        <div className="space-y-3">          {channels.map((channel, idx) => (            <div key={idx}>              <div className="flex justify-between items-center mb-1">                <span className="text-sm text-foreground">{channel.name}</span>                <span className="text-sm font-bold text-foreground">                  ${channel.revenue.toLocaleString()}                </span>              </div>              <div className="flex items-center gap-2">                <div className="flex-1 bg-zinc-100 dark:bg-zinc-800 rounded-full h-2 overflow-hidden">                  <motion.div                    initial={{ width: 0 }}                    animate={{ width: `${channel.percentage}%` }}                    transition={{ duration: 1, delay: idx * 0.1 }}                    className={`h-full ${channel.color} rounded-full`}                  />                </div>                <span className="text-xs text-muted-foreground w-8 text-right">                  {channel.percentage}%                </span>              </div>            </div>          ))}        </div>      </div>    </motion.div>  );};

Usage

This component is a data-rich dashboard card displaying e-commerce metrics with animated visualizations and dark mode support. Perfect for dashboards, landing pages, and analytics interfaces.

Prop

Type