bklitai

Candlestick Chart

Component 10

About

A composable OHLC candlestick chart with animated candles, gridlines, axes, and a hover tooltip for visualizing stock/crypto price data.

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

Code

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

Usage.tsx

"use client";

import CandlestickChart from "@/components/ui/candlestick-chart";
import Candlestick from "@/components/ui/candlestick-chart-utils/candlestick";
import Grid from "@/components/ui/candlestick-chart-utils/grid";
import XAxis from "@/components/ui/candlestick-chart-utils/x-axis";
import YAxis from "@/components/ui/candlestick-chart-utils/y-axis";
import ChartTooltip from "@/components/ui/candlestick-chart-utils/chart-tooltip";

const ohlcData = [
  { date: new Date("2024-01-02"), open: 100, high: 108, low: 98, close: 105 },
  { date: new Date("2024-01-03"), open: 105, high: 110, low: 102, close: 103 },
  { date: new Date("2024-01-04"), open: 103, high: 112, low: 101, close: 110 },
  { date: new Date("2024-01-05"), open: 110, high: 115, low: 107, close: 108 },
];

export default function Component() {
  return (
    <main className="flex min-h-svh w-full items-center justify-center p-6 md:p-10">
      <div className="w-full max-w-3xl">
        <CandlestickChart data={ohlcData}>
          <Grid horizontal vertical />
          <Candlestick />
          <XAxis />
          <YAxis />
          <ChartTooltip />
        </CandlestickChart>
      </div>
    </main>
  );
}

Dependencies

More by bklitai

View all
  • Funnel Chart

    Funnel Chart

    398
  • Area Chart

    Area Chart

    357
  • Bar Chart

    Bar Chart

    118
  • Sankey Diagram

    Sankey Diagram

    29

Explore more

Part of Bklit — browse the full library on 21st.dev.