shadcn Candlestick Chart: OHLC Prices in a shadcn Project
shadcn/ui charts are built on Recharts, and neither has a candlestick chart. The request to add one to the shadcn charts is open (shadcn-ui/ui#12719), and the person asking put it simply: the gallery has nothing for financial or range data.
This guide explains what a good candlestick chart needs, how people build one on Recharts today, and how to install a ready-made one with the shadcn CLI.
What a candlestick shows
Each period (a day, a week) gets one candle:
- The body spans the open and the close.
- The wick spans the low to the high.
- The direction shows whether the price closed above or below where it opened.
One glyph carries the range and the direction of a period, which is why traders and pricing teams read it faster than a line of closing prices.
What a good one needs
- Direction that doesn't depend on color. Rising candles hollow, falling candles filled. Red and green alone fail for color-blind readers and in print.
- Volume in its own panel. Volume and price have different units. Drawing volume bars behind the candles on a second axis is a dual axis; give it its own panel under the prices, sharing the x axis.
- Validation. A row where the high is below the open or close is malformed. It should be rejected and listed, not drawn as a strange candle or silently fixed.
- Gaps for missing periods (weekends, holidays, missing data), not zeros.
- A crosshair and a table, so the exact open, high, low and close of any candle can be read.
Building it on Recharts
Recharts has no OHLC series, so the usual approach is a Bar with a custom shape: pass [low, high] as the bar value, then draw the body and wick yourself inside the shape from the open and close. It works, but you write the drawing, the hollow/filled logic, the validation and the tooltip, and volume still needs its own chart.
Install a ready-made candlestick chart
ChartslibraryUI's candlestick chart is part of Pro. After buying, install it from your Pro download with the same tooling as the free charts:
npx chartslibraryui add candlestick-chart --from ./chartslibraryui-proIt becomes a single file in components/charts/ that you own and can edit, styled by the same CSS variables as the rest of your shadcn theme.
The data is an array of rows:
[{ date: "2026-03-02", open: 142.1, high: 144.0, low: 141.2, close: 143.5, volume: 1.8e6 }]What it does:
- Hollow-up, filled-down candles, so direction never depends on color.
- Volume in a separate panel when you pass it, with one shared crosshair.
- Malformed rows (high below open or close) rejected and listed under the chart.
- Keyboard navigation, a table view and CSV export.
When not to use a candlestick
- Only the close matters (a portfolio value, a KPI): use a line chart. It's free.
- The audience isn't used to candles. For a general business audience, a line of closing prices with a shaded high-low band is easier to read.
- You want the distribution of values, not their order in time: use a box plot.