Kavi Katiyar

Stock Portfolio Card

Cards 167

About

Stock Portfolio Card This component provides a comprehensive view of a user's stock portfolio, including total gain, individual holdings, and related news. It's designed to be highly reusable, accepting all data through props.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Stock Portfolio Card to your project and fits it to your theme.

Code

How Stock Portfolio Card is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { StockPortfolioCard } from "@/components/ui/stock-portfolio-card"; // Adjust the import path

const Demo = () => {
  // Sample data to populate the component
  const portfolioData = {
    totalGain: 5849.05,
    returnPercentage: 110.28,
    asOfDate: "Nov 24, 2024",
    holdings: [
      {
        ticker: "AAPL",
        name: "Apple Inc.",
        shares: 10,
        lastPrice: 2324.70,
        changeValue: 2.25,
        changePercent: 0.097,
      },
      {
        ticker: "META",
        name: "Meta Platforms Inc.",
        shares: 5,
        lastPrice: 3524.35,
        changeValue: -91.98,
        changePercent: 2.6,
      },
      {
        ticker: "TSLA",
        name: "Tesla, Inc.",
        shares: 15,
        lastPrice: 1805.60,
        changeValue: 45.10,
        changePercent: 2.56,
      },
    ],
    news: [
      {
        category: "AI",
        time: "7 min ago",
        title: "Tokyo Electron Plans Expansion Despite AI Spending Doubts",
        source: "Bloomberg",
      },
      {
        category: "Big Tech",
        time: "25 min ago",
        title: "Apple Debuts New M4 Chips, Focuses on AI Changes in iOS 19",
        source: "Reuters",
      },
      {
        category: "Markets",
        time: "1 hr ago",
        title: "Federal Reserve Signals Potential Pause in Rate Hikes Amidst Inflation Data",
        source: "Wall Street Journal",
      },
    ],
  };

  return (
    <div className="flex items-center justify-center bg-background p-4 sm:p-8">
      <StockPortfolioCard
        totalGain={portfolioData.totalGain}
        returnPercentage={portfolioData.returnPercentage}
        asOfDate={portfolioData.asOfDate}
        holdings={portfolioData.holdings}
        news={portfolioData.news}
      />
    </div>
  );
};

export default Demo;

Dependencies

More by Kavi Katiyar

View all
  • 3D Card

    3D Card

    1.1K
  • Bento Product Features

    Bento Product Features

    879
  • Testimonial Slider

    Testimonial Slider

    743
  • Card

    Card

    625
  • Order Confirmation Card

    Order Confirmation Card

    540
  • Project Detail View

    Project Detail View

    435
  • Animated Card

    Animated Card

    411
  • Performance Benchmark Card

    Performance Benchmark Card

    407

More in Cards

View all
  • Course Design Cards

    Course Design Cards

    1.3K
  • Card Studio

    Card Studio

    11
  • Statistics Card 2

    Statistics Card 2

    304
  • Statistics Card 7

    Statistics Card 7

    326
  • Card

    Card

    18
  • Interactive Tech Stack Bento Grid with Hover Effects

    Interactive Tech Stack Bento Grid with Hover Effects

    604
  • Card

    Card

    59
  • Stats cards with links

    Stats cards with links

    95