Kavi Katiyar

Stock Portfolio Card

Cards 146

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

    981
  • Bento Product Features

    Bento Product Features

    831
  • Testimonial Slider

    Testimonial Slider

    716
  • Card

    Card

    607
  • Order Confirmation Card

    Order Confirmation Card

    504
  • Project Detail View

    Project Detail View

    408
  • State

    State

    393
  • Animated Card

    Animated Card

    393

More in Cards

View all
  • Statistics Card 2

    Statistics Card 2

    264
  • Course Design Cards

    Course Design Cards

    1.1K
  • Card

    Card

    70
  • Stats cards with links

    Stats cards with links

    39
  • The Item one

    The Item one

    3
  • Card Studio

    Card Studio

    7
  • Statistics Card 7

    Statistics Card 7

    292
  • Item

    Item

    10