Kavi Katiyar

Stock Portfolio Card

Cards 149

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

    997
  • Bento Product Features

    Bento Product Features

    836
  • Testimonial Slider

    Testimonial Slider

    717
  • Card

    Card

    613
  • Order Confirmation Card

    Order Confirmation Card

    508
  • Project Detail View

    Project Detail View

    413
  • Animated Card

    Animated Card

    401
  • State

    State

    394

More in Cards

View all
  • Course Design Cards

    Course Design Cards

    1.1K
  • Statistics Card 2

    Statistics Card 2

    269
  • Statistics Card 7

    Statistics Card 7

    295
  • Card

    Card

    56
  • Stats cards with links

    Stats cards with links

    86
  • Interactive Tech Stack Bento Grid with Hover Effects

    Interactive Tech Stack Bento Grid with Hover Effects

    108
  • The Item one

    The Item one

    3
  • Card Studio

    Card Studio

    36