Vector Motion
E-Commerce

Packaging Costs Card - Expense Tracking

Track packaging expenses and cost per order. Monitor shipping material costs and optimize packaging efficiency.

Packaging Costs Card

The Packaging Costs Card Track packaging expenses and cost optimization.

Preview

Installation

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

Packaging Costs Card
'use client';import React from "react";import { Package, DollarSign } 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 Material {  type: string;  cost: number;  percentage: number;  perUnit: number;  [key: string]: any;}interface PackagingCostsCardProps {  className?: string;  title?: string;  description?: string;  materials?: Material[];}const DEFAULT_TITLE = "Packaging Costs";const DEFAULT_DESCRIPTION = "Material Expenses";const DEFAULT_MATERIALS: Material[] = [  { type: "Boxes", cost: 2450, percentage: 45, perUnit: 0.85 },  { type: "Bubble Wrap", cost: 1200, percentage: 22, perUnit: 0.42 },  { type: "Tape & Labels", cost: 980, percentage: 18, perUnit: 0.34 },  { type: "Filler Material", cost: 820, percentage: 15, perUnit: 0.29 },];export const PackagingCostsCard: React.FC<PackagingCostsCardProps> = ({  className = "",  title = DEFAULT_TITLE,  description = DEFAULT_DESCRIPTION,  materials = DEFAULT_MATERIALS,}) => {  const isInteractive = true;  const index = 38;  const totalCost = materials.reduce((sum, m) => sum + m.cost, 0);  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">          <Package className="h-5 w-5 text-amber-500" />        </div>      </div>      <div className="relative z-10 flex-1">        <div className="text-2xl font-bold text-foreground mb-1">          ${(totalCost / 1000).toFixed(1)}K        </div>        <p className="text-sm text-muted-foreground mb-4">          Monthly packaging costs        </p>        <div className="space-y-3">          {materials.map((material, idx) => (            <div key={idx}>              <div className="flex justify-between items-center mb-1">                <span className="text-sm text-foreground">{material.type}</span>                <div className="flex items-center gap-2">                  <span className="text-xs text-muted-foreground">                    ${material.perUnit}/unit                  </span>                  <span className="text-sm font-bold text-foreground">                    ${material.cost}                  </span>                </div>              </div>              <div className="flex-1 bg-zinc-100 dark:bg-zinc-800 rounded-full h-2 overflow-hidden">                <motion.div                  initial={{ width: 0 }}                  animate={{ width: `${material.percentage}%` }}                  transition={{ duration: 1, delay: idx * 0.1 }}                  className="h-full bg-amber-500 rounded-full"                />              </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