Chart
Recharts v3 composed with Eskais tokens: ChartContainer maps a config to --color-<key> variables (light and dark), popover tooltips and legends, and ChartDataTable renders the same data as a table for screen readers and agents. The container is a figure that requires a name.
Example
Agent tasks per week
| Week | Done | Failed |
|---|---|---|
| W1 | 18 | 3 |
| W2 | 24 | 5 |
| W3 | 21 | 2 |
| W4 | 30 | 4 |
| W5 | 27 | 1 |
| W6 | 35 | 2 |
chart-demo.tsxCopy code
Installation
Copy code
Usage
ImportCopy code
API reference
ChartTooltipContent
| Prop | Type | Default |
|---|---|---|
active | boolean | – |
payload | readonly TooltipPayloadEntry[] | – |
label | string | number | – |
labelKey | string | – |
nameKey | string | – |
indicator | "dot" | "line" | "dashed" | "dot" |
hideLabel | boolean | false |
hideIndicator | boolean | false |
color | string | – |
labelFormatter | (label: ReactNode, payload: readonly TooltipPayloadEntry[]) => ReactNode | – |
formatter | (value: unknown, name: unknown, item: TooltipPayloadEntry, index: number) => ReactNode | – |
className | string | – |
labelClassName | string | – |
Also takes ChartFormatOptions.
ChartLegendContent
| Prop | Type | Default |
|---|---|---|
className | string | – |
payload | readonly LegendPayload[] | – |
verticalAlign | "top" | "middle" | "bottom" | "bottom" |
nameKey | string | – |
hideIcon | boolean | false |
ChartDataTable
Takes ChartName &.
ChartStyle
| Prop | Type | Default |
|---|---|---|
idrequired | string | – |
configrequired | ChartConfig | – |
ChartContainer
Takes Omit<ComponentProps<"figure">, "children" | "aria-label" | "aria-labelledby"> &.
Other exports
chartStyleSheetchartSwatchColorformatChartValueresolveChartSeriesChartContextuseChartChartLegendChartTooltiptype ChartConfigtype ChartFormattype ChartFormatOptionstype ChartNametype ChartSeriesConfigtype ChartSeriesThemetype ChartIndicatortype ChartTooltipContentPropstype ChartLegendContentPropstype ChartDataTablePropstype ChartRowtype ChartContainerPropsAccessibility
- ChartContainer takes aria-labelledby; Recharts' accessibilityLayer adds keyboard navigation.
- ChartDataTable gives the same numbers as a table, and legends keep meaning off colour alone.
Agent actions
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.