Ravi Katiyar

Stock Card

Buttons 204

About

Stock Card This component, StockCard, displays stock information with a smooth hover animation. It's designed to be highly reusable, accepting props for the logo, ticker, name, price, and percentage change.

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

Code

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

Usage.tsx

import { StockCard } from "@/components/ui/stock-card";

// Sample data for demonstration
const stocksData = [
  {
    logoSrc: "https://logo.clearbit.com/google.com",
    ticker: "GOOG",
    name: "Alphabet Inc.",
    price: 156.06,
    change: 4.89,
  },
  {
    logoSrc: "https://logo.clearbit.com/nvidia.com",
    ticker: "NVDA",
    name: "NVIDIA Corporation",
    price: 19270.30,
    change: -1.35,
  },
  {
    logoSrc: "https://logo.clearbit.com/apple.com",
    ticker: "AAPL",
    name: "Apple Inc.",
    price: 217.90,
    change: 2.66,
  },
  {
    logoSrc: "https://logo.clearbit.com/starbucks.com",
    ticker: "SBUX",
    name: "Starbucks Corporation",
    price: 97.73,
    change: 1.13,
  },
  {
    logoSrc: "https://logo.clearbit.com/nike.com",
    ticker: "NKE",
    name: "Nike, Inc.",
    price: 63.29,
    change: -3.81,
  },
];

export default function StockCardDemo() {
  // Handler for the buy action
  const handleBuyStock = (ticker: string) => {
    alert(`Initiating buy for ${ticker}...`);
  };

  return (
    <div className="w-full bg-background p-8 flex items-center justify-center">
      <div className="flex flex-col gap-4">
        {stocksData.map((stock) => (
          <StockCard
            key={stock.ticker}
            logoSrc={stock.logoSrc}
            ticker={stock.ticker}
            name={stock.name}
            price={stock.price}
            change={stock.change}
            onBuy={handleBuyStock}
          />
        ))}
      </div>
    </div>
  );
}

Dependencies

More by Ravi Katiyar

View all
  • Animated Shader Hero

    Animated Shader Hero

    3.7K
  • Hero

    Hero

    3.1K
  • Circular Gallery

    Circular Gallery

    2.7K
  • Minimalist Hero

    Minimalist Hero

    2.5K
  • Floating Icons Hero Section

    Floating Icons Hero Section

    1.9K
  • Glass Calendar

    Glass Calendar

    1.8K
  • Feature Carousel

    Feature Carousel

    1.7K
  • AI Image Generator Hero

    AI Image Generator Hero

    1.4K

More in Buttons

View all
  • Button Save

    Button Save

    46
  • Button

    Button

    20
  • Eclipse Button

    Eclipse Button

    5
  • Button

    Button

    6
  • Button

    Button

    14
  • Button Group

    Button Group

    37
  • Button

    Button

    32
  • Split Button

    Split Button

    32