Candlestick Chart

Candlestick Chart

Charts
Trading

OHLC (Open, High, Low, Close) candlestick charts for trading and time-series data visualization.

Preview

Crypto trading chart with timeframe selection

Ethereum
ETH/USD
24h High

$3,920

24h Low

$3,850

Live Price

$3,910.72

09:0009:3010:0010:3011:0011:3012:00

Props

Component API reference

PropTypeDefaultDescription
data*CandleData[]—Array of OHLC candle objects
heightnumber256Plot height in pixels
showGridbooleantrueShow dashed grid lines
showAxisbooleanfalseShow price labels on the y-axis
paddingnumber0.08Fraction of the data range added above and below the plot
labelsstring[]—X-axis labels, spread evenly under the plot
highlightLabelstring—X-axis label shown in the primary color
bullColorstring'var(--color-success-default)'Color for rising candles
bearColorstring'var(--color-danger-default)'Color for falling candles
formatValue(value: number) => string—Formats y-axis values and tooltips

Usage

Import and implementation examples

import { CandlestickChart } from '@/components/ui/candlestick-chart'
const candles = [
{ open: 45, close: 60, high: 70, low: 40 }, // bullish
{ open: 60, close: 50, high: 65, low: 45 }, // bearish
{ open: 50, close: 65, high: 75, low: 48 },
]
// The y-scale is fitted to the data range, so candles fill the plot
<CandlestickChart
data={candles}
labels={['09:00', '10:00', '11:00']}
showAxis
/>

Features

Built-in functionality

  • OHLC data: Shows open, high, low, close prices per period
  • Color coding: Green for bullish, red for bearish movements
  • Fitted y-scale: Scale follows the data range plus padding, so candles fill the plot
  • Grid lines: Optional dashed grid for value reading
  • Hover states: Interactive candle highlighting

Accessibility

Accessibility considerations

ARIA Attributes

Chart container has role="img"aria-label describes the data rangeEach candle has a native tooltip with its OHLC values

Keyboard Navigation

KeyAction
TabNavigate between timeframe tabs
Enter / SpaceSelect timeframe

Notes

  • Provide data table alternative for screen readers
  • Price changes announced with direction
  • Color is supplemented with position indicators