CandlestickChart
Read a market, a risk or a return, with the axis and the tooltip wired for the job.
@luc/ui/chartsWhat it shows
Read open, high, low and close movement across ordered trading sessions, with optional supplied overlays.
Live preview
Eight synthetic sessions with one supplied moving average; the band is your line, not the chart's calculation.
<CandlestickChart
candles={[
{ time: 1791244800000, open: 98.4, high: 99.6, low: 98.1, close: 99.2 },
{ time: 1791331200000, open: 99.2, high: 99.8, low: 98.2, close: 98.6 },
{ time: 1791417600000, open: 98.6, high: 98.9, low: 97.1, close: 97.4 },
{ time: 1791504000000, open: 97.4, high: 98.2, low: 97, close: 97.9 },
{ time: 1791590400000, open: 97.9, high: 99.1, low: 97.7, close: 98.8 },
{ time: 1791676800000, open: 98.8, high: 99.4, low: 98.3, close: 98.5 },
{ time: 1791763200000, open: 98.5, high: 98.7, low: 96.4, close: 96.8 },
{ time: 1791849600000, open: 96.8, high: 97.5, low: 96.2, close: 97.2 },
]}
overlays={[{ label: "MA 3", values: [null, null, 98.4, 97.97, 98.03, 98.4, 98.03, 97.5] }]}
priceFormat={{ kind: "number", decimals: 2 }}
height={340}
ariaLabel="Synthetic daily candles"
/>Controls
Height
A chart measures its container, so it always needs a definite height.
State
The surface the chart is in — loading, empty and error are drawn by the component.
Accessible name
A drawing is not readable by a screen reader, so it needs a name that states what it shows.
The same fixture as the live preview above; the controls change how it is drawn, not what it measures.
Code
import { CandlestickChart } from "@luc/ui/charts";
<CandlestickChart
candles={[
{ time: 1791244800000, open: 98.4, high: 99.6, low: 98.1, close: 99.2 },
{ time: 1791331200000, open: 99.2, high: 99.8, low: 98.2, close: 98.6 },
{ time: 1791417600000, open: 98.6, high: 98.9, low: 97.1, close: 97.4 },
{ time: 1791504000000, open: 97.4, high: 98.2, low: 97, close: 97.9 },
{ time: 1791590400000, open: 97.9, high: 99.1, low: 97.7, close: 98.8 },
{ time: 1791676800000, open: 98.8, high: 99.4, low: 98.3, close: 98.5 },
{ time: 1791763200000, open: 98.5, high: 98.7, low: 96.4, close: 96.8 },
{ time: 1791849600000, open: 96.8, high: 97.5, low: 96.2, close: 97.2 },
]}
overlays={[{ label: "MA 3", values: [null, null, 98.4, 97.97, 98.03, 98.4, 98.03, 97.5] }]}
priceFormat={{ kind: "number", decimals: 2 }}
height={340}
ariaLabel="Synthetic daily candles"
state="ready"
/>Not controllable here
series / rows— The numbers are the caller's; the fixture above is the example.
Copy for an AI agentA specification an agent can act on: the import, the setup, the chosen props, the data contract and the accessibility expectation.
Implement `CandlestickChart` from Luc UI. It is: Read a market, a risk or a return, with the axis and the tooltip wired for the job.
Import it with: import { CandlestickChart } from "@luc/ui/charts";
Requires: react ^19.0.0; react-dom ^19.0.0; react-hook-form ^7.0.0 (optional, for @luc/ui/forms/react-hook-form); tailwindcss ^4.0.0; node >= 22 (repository tools). Import the stylesheet once at the app root and wrap the tree in `LucProvider`. Both come from the package that publishes @luc.
Chosen configuration: `height={340}`, `state="ready"`, `ariaLabel="Synthetic daily candles"`.
Accessibility: keep the component's own semantics. Do not re-implement its ARIA wiring, do not add roles it does not declare, and make sure every interactive element is reachable and operable from the keyboard with a visible focus state.
Styling: use Luc UI design tokens and the component's own props. Do not restyle with raw colour literals and do not override the component's internal structure with page CSS.
Motion: respect `prefers-reduced-motion`. The component already does, so do not disable it.
Reproduce this state:
```tsx
<CandlestickChart
candles={[
{ time: 1791244800000, open: 98.4, high: 99.6, low: 98.1, close: 99.2 },
{ time: 1791331200000, open: 99.2, high: 99.8, low: 98.2, close: 98.6 },
{ time: 1791417600000, open: 98.6, high: 98.9, low: 97.1, close: 97.4 },
{ time: 1791504000000, open: 97.4, high: 98.2, low: 97, close: 97.9 },
{ time: 1791590400000, open: 97.9, high: 99.1, low: 97.7, close: 98.8 },
{ time: 1791676800000, open: 98.8, high: 99.4, low: 98.3, close: 98.5 },
{ time: 1791763200000, open: 98.5, high: 98.7, low: 96.4, close: 96.8 },
{ time: 1791849600000, open: 96.8, high: 97.5, low: 96.2, close: 97.2 },
]}
overlays={[{ label: "MA 3", values: [null, null, 98.4, 97.97, 98.03, 98.4, 98.03, 97.5] }]}
priceFormat={{ kind: "number", decimals: 2 }}
height={340}
ariaLabel="Synthetic daily candles"
state="ready"
/>
```Usage
The values are prepared by the caller: this component draws the points it is given and computes no statistic of its own, so units, scaling and any summary have to be settled before the data reaches it.
It is drawn by the Lightweight Charts engine.
Worked examples with real data are on the family overview: Financial & quantitative
import { CandlestickChart } from "@luc/ui/charts";<CandlestickChart
candles={[
{ time: 1791244800000, open: 98.4, high: 99.6, low: 98.1, close: 99.2 },
{ time: 1791331200000, open: 99.2, high: 99.8, low: 98.2, close: 98.6 },
{ time: 1791417600000, open: 98.6, high: 98.9, low: 97.1, close: 97.4 },
{ time: 1791504000000, open: 97.4, high: 98.2, low: 97, close: 97.9 },
{ time: 1791590400000, open: 97.9, high: 99.1, low: 97.7, close: 98.8 },
{ time: 1791676800000, open: 98.8, high: 99.4, low: 98.3, close: 98.5 },
{ time: 1791763200000, open: 98.5, high: 98.7, low: 96.4, close: 96.8 },
{ time: 1791849600000, open: 96.8, high: 97.5, low: 96.2, close: 97.2 },
]}
overlays={[{ label: "MA 3", values: [null, null, 98.4, 97.97, 98.03, 98.4, 98.03, 97.5] }]}
priceFormat={{ kind: "number", decimals: 2 }}
height={340}
ariaLabel="Synthetic daily candles"
/>Data contract
`candles` contain `time`, `open`, `high`, `low` and `close`; every row must satisfy `low <= min(open, close) <= max(open, close) <= high`. `overlays[].values` must align to the same sessions.
Important configuration
Use `priceFormat` for the quoted unit, keep overlays explicitly labelled and supplied, and choose a bounded height that lets the wick and body geometry remain legible.
Guidelines
When not to use
Do not treat the chart as volume data or as a live market feed; those are separate inputs, and the fixture is not a price prediction.
Configuration
| Export | Kind | Signature |
|---|---|---|
CandlestickChart | 14 documented props | ({ candles, overlays, priceFormat, timeFormat, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: CandlestickChartProps) => import("@types/react").J… |
CandlestickChart props
Type: CandlestickChartProps
Values the compiler reads from the declaration.
| Prop | Type | Default | Notes |
|---|---|---|---|
ariaDescription? | string | undefined | — | |
ariaLabel? | string | undefined | — | |
candles | readonly Candle[] | — | |
className? | string | undefined | — | |
description? | string | undefined | — | |
eager? | boolean | undefined | — | Create the engine on mount rather than when the surface is approached. |
height? | string | number | undefined | — | |
onEvent? | ((event: EChartEvent) => void) | undefined | — | |
onReady? | ((chart: EChartsInstance) => void) | undefined | — | |
overlays? | readonly CandleOverlay[] | undefined | — | Overlaid lines (moving averages, bands) — supplied, not computed. |
priceFormat? | ChartFormat | undefined | — | |
state? | ChartState | undefined | — | |
timeFormat? | ChartFormat | undefined | — | |
title? | string | undefined | — |
Accessibility
A chart is a picture of data, so it needs a name that states what it shows, and the numbers must exist as text somewhere on the page — in a table or a written summary — because a drawing is not readable by a screen reader and cannot be copied.
What happens on the server, and when hydration changes it.
Family
Financial & quantitative
Presentation only: not one metric here is computed by the library.
Related