Candlestick chart
Display open, high, low, and close values for an ordered set of intervals.
- Rising, hollow body
- Falling, filled body
- Open
- $42.00
- High
- $48.00
- Low
- $39.00
- Close
- $46.00
View data table 6 rows
| Data point | Open | High | Low | Close |
|---|---|---|---|---|
| Mon | $42.00 | $48.00 | $39.00 | $46.00 |
| Tue | $46.00 | $51.00 | $44.00 | $49.00 |
| Wed | $49.00 | $50.00 | $43.00 | $45.00 |
| Thu | $45.00 | $53.00 | $44.00 | $51.00 |
| Fri | $51.00 | $55.00 | $48.00 | $53.00 |
| Sat | $53.00 | $54.00 | $47.00 | $49.00 |
Installation
bunx --bun shadcn@latest add https://apple-ui-eduardo.vercel.app/r/candlestick-chart.jsonThe registry includes the shared styles and dependencies. Import @/components/apple-ui/styles.css in your root layout once. For the package route, use the installation guide.
Usage
"use client";
import { CandlestickChart } from "@eduardoul/apple-ui";
const data = [
{ label: "Mon", open: 42, high: 48, low: 39, close: 46 },
{ label: "Tue", open: 46, high: 51, low: 44, close: 49 },
{ label: "Wed", open: 49, high: 50, low: 43, close: 45 },
{ label: "Thu", open: 45, high: 53, low: 44, close: 51 },
];
export function Example() {
return (
<CandlestickChart
title="Daily price range"
description="Synthetic prices in USD"
data={data}
valueFormatter={(value) => "$" + value.toFixed(2)}
/>
);
}Package imports use @eduardoul/apple-ui. Registry imports use @/components/apple-ui. Add "use client" to files that use state or event handlers.
API reference
| Property | Type | Default |
|---|---|---|
| data | CandlestickDatum[] | required |
| title | string | required |
| description | string | undefined |
| height | number | component default |
| loading | boolean | false |
| error | string | undefined |
| emptyMessage | string | No data to display. |
| showTable | boolean | true |
| compact | boolean | false |
| valueFormatter | (value: number) => string | localized number |
| className | string | undefined |
| style | React.CSSProperties | undefined |
Use className and style to customize the component. The package includes full TypeScript definitions for its supported element properties and refs.
Design guidance
- Use candlesticks only when open, high, low, and close values all matter.
- Keep intervals evenly ordered and state the unit in the title, description, or formatter.
- Explain the rising and falling color convention near the chart. Do not rely on color alone.
Accessibility
Give the chart a descriptive title and explain its units. Select a data point to read its values, or open the data table for the full dataset. Labels and values accompany color, and the chart adapts to reduced motion and appearance preferences. Test long labels, touch input and keyboard navigation with your own data.
Library styles support reduced motion, reduced transparency, increased contrast and forced colors. Read the accessibility foundation for the checks your application still needs.