A React composed chart that combines bar, line, and area series for multi-metric web dashboards.
ComposedChart is a subpath-only import (@heroui-pro/react/composed-chart) because it depends on the optional recharts peer. It is not exported from the package root, so SSR apps that don't use it never need recharts installed.
import {ComposedChart} from "@heroui-pro/react/composed-chart";
<ComposedChart data={data}>
<ComposedChart.Grid /> {/* Optional */}
<ComposedChart.XAxis /> {/* Optional */}
<ComposedChart.YAxis /> {/* Optional */}
<ComposedChart.Bar dataKey="revenue" />
<ComposedChart.Line dataKey="target" />
<ComposedChart.Area dataKey="forecast" />
<ComposedChart.Tooltip content={<ComposedChart.TooltipContent />} /> {/* Optional */}
</ComposedChart>;HeroUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.
The Composed Chart component uses these CSS classes:
.composed-chart: Root container wrapping ResponsiveContainer and the Recharts chart.The following CSS rules target Recharts internal class names to apply HeroUI design tokens automatically:
.composed-chart .recharts-cartesian-axis-tick-value: Axis tick labels. 10px muted text..composed-chart .recharts-cartesian-axis-line: Axis lines. Hidden by default..composed-chart .recharts-cartesian-axis-tick-line: Tick lines. Hidden by default..composed-chart .recharts-cartesian-grid line: Cartesian grid lines. Muted stroke at 0.15 opacity..composed-chart .recharts-tooltip-cursor: Tooltip cursor. Dashed vertical line on hover..composed-chart .recharts-active-dot circle: Active dot. Outlined with surface color for contrast.The root wrapper. Renders a ResponsiveContainer + Recharts ComposedChart with HeroUI CSS theming applied automatically.
| Prop | Type | Default | Description |
|---|---|---|---|
data | Record<string, number | string>[] | - | Chart data: array of objects with numeric/string fields for each series. |
height | number | 300 | Chart height in pixels. |
width | number | `${number}%` | "100%" | Chart width in pixels or percentage string. |
margin | { top?: number; right?: number; bottom?: number; left?: number } | { top: 8, right: 8, bottom: 0, left: 0 } | Recharts margin around the chart area. |
children | ReactNode | - | Recharts child components (ComposedChart.Bar, ComposedChart.Line, ComposedChart.Area, etc.). |
Also supports all native div HTML attributes.
Re-exported Recharts Bar component. Follows the Recharts Bar API.
Re-exported Recharts Line component. Follows the Recharts Line API.
Re-exported Recharts Area component. Follows the Recharts Area API.
Re-exported Recharts XAxis component. Follows the Recharts XAxis API.
Re-exported Recharts YAxis component. Follows the Recharts YAxis API.
Re-exported Recharts CartesianGrid component. Follows the Recharts CartesianGrid API.
Re-exported Recharts Tooltip component. Follows the Recharts Tooltip API. Use with ComposedChart.TooltipContent for styled tooltips.
Pre-built tooltip renderer for Recharts. Pass as the content prop of ComposedChart.Tooltip. See ChartTooltip for full props.
Resources