ChartCandlestick
OHLC candlestick chart engine. Renders one candle per datum — a rectangular body between open and close plus a thin wick from low to high. Bullish (close ≥ open) and bearish candles use distinct intent colours.
Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-chart-candlestick> — 6 internal parts.- 1.origam-chart-candlestick__header
- Header block. Contains the title and subtitle divs. Hidden when both are absent.
- 2.origam-chart-candlestick__body
- Body flex container. Wraps the SVG, tooltip and empty-state overlay.
- 3.origam-chart-candlestick__grid
element holding horizontal Y-tick grid lines. Hidden when showGrid=false. - 4.origam-chart-candlestick__candle
per datum. Contains the wick and body . Keyboard-focusable (tabindex=0, role=button). - 5.origam-chart-candlestick__axis
holding all axis tick labels. Hidden when showAxis=false. - 6.origam-chart__legend (via OrigamChartLegend)
- Legend list rendered by the extracted OrigamChartLegend sub-component. grid-area: legend.
API
Props
All props accepted by this component, with their type, default value and description.
- heightnumber | string400
- Chart height. Accepts a number (px) or any CSS length. Overridden by aspectRatio when set.
- Fill colour for bullish candles (close ≥ open). Accepts a TIntent token or any CSS colour.
- Fill colour for bearish candles (close < open). Accepts a TIntent token or any CSS colour.
- candleWidthnumber0.6
- Fraction of the per-slot width occupied by the candle body. Range 0–1.
- wickWidthnumber1
- Wick stroke width in SVG user-units.
- showLegendbooleanfalse
- Toggle the legend. Defaults to false — candlestick charts rarely need a legend.
- showTooltipbooleantrue
- Toggle the hover tooltip.
- showGridbooleantrue
- Render background grid lines.
- showAxisbooleantrue
- Render X and Y axes with tick labels.
- yMinnumber
- Override the auto-computed Y-axis minimum. When omitted, derived from min(low) with 5% padding.
- yMaxnumber
- Override the auto-computed Y-axis maximum. When omitted, derived from max(high) with 5% padding.
- xAxisFormat(value: string | number) => string
- Formatter applied to X-axis (date) tick labels.
- yAxisFormat(value: number) => string
- Formatter applied to Y-axis (price) tick labels.
- stylestring | Array<string> | object | StyleValue
- titlestring
- Optional chart title rendered above the plotting area.
- idstring
- classstring | Array<string> | object
- widthnumber | string
- aspectRatiostring
- CSS aspect-ratio shortcut (e.g. "16/9"). When set, overrides height.
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- bgColorTColor
- roundedboolean | number | string | TRounded | null | undefined
- elevationTElevation
- paddingboolean | number | string
- marginboolean | number | string
- fontSizeTFontSize
- fontWeightTFontWeight
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- seriesrequiredArray<IChartSeries>[]
- Data series. series[0].data must be an array of { date, open, high, low, close } objects. Extra series are ignored.
- subtitlestring
- Optional subtitle rendered below the title.
- Anchor of the legend block: top, bottom, left, right.
- animatedbooleantrue
- Animate candles on first paint. Respects prefers-reduced-motion.
- animationDurationnumber600
- Animation duration in milliseconds.
- Palette used when a series does not pin its own color. Cycles through the 8 origam intents by default.
API
Slots
Content slots exposed by this component.
- #tooltip
- Replace the default tooltip card. Receives full OHLC datum, change and direction for custom rendering.
- #legend-item
- Replace one legend entry.
- #title
- Replace the title block (title + subtitle).
- #empty
- Rendered when series is empty or contains no valid OHLC data.
API
Emits
Events emitted by this component.
- @point-clickIChartPoint, MouseEvent | KeyboardEvent
- Fired on mouse click or Enter/Space on a candle.
- @legend-clickIChartSeries, number
- Fired when the user clicks a legend entry.
- @series-toggleIChartSeries, boolean
- Resulting visibility flip after a legend click.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Chart root background colour.
- Inner padding of the chart root.
- Gap between header, body and legend areas.
- Duration of the candle fade-in animation. Set by animationDuration prop.
- Stroke colour of horizontal grid lines.
- Font size of axis tick labels.
- Tooltip background colour.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Moves focus between interactive candles. |
| Enter / Space | Activates the focused candle and fires point-click. |
Notes
- Root element has role="figure" with aria-label set to the title prop or "candlestick chart".
- SVG has role="img" with <title> and <desc> elements describing the data.
- Each candle has role="button", tabindex=0, and aria-label describing date, direction, open, high, low, close.
- All animations are disabled under prefers-reduced-motion: reduce.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- colorvar(--origam-color__surface---default)
- Root chart background.
- dimensionvar(--origam-space---3)
- Chart inner padding.
- colorvar(--origam-color__border---subtle)
- Grid line colour.
- colorvar(--origam-color__surface---inverse)
- Tooltip background.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Basic candlestick chart
Ecosystem
Family
Components from the same folder that share conventions and often compose together.