Skip to content
Eskais UI

Data

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

WeekDoneFailed
W1183
W2245
W3212
W4304
W5271
W6352

Installation

npx shadcn@latest add @eskais/chart
Brings alongnarrowtablelocale
npm packagesrecharts@3.10.1

Usage

Import
import {  chartStyleSheet,  chartSwatchColor,  formatChartValue,  resolveChartSeries,} from "@/lib/chart-config"import { ChartContext, useChart } from "@/components/ui/chart-context"import { ChartTooltipContent } from "@/components/ui/chart-tooltip"import { ChartLegendContent } from "@/components/ui/chart-legend"import { ChartDataTable } from "@/components/ui/chart-data-table"import {  ChartContainer,  ChartLegend,  ChartStyle,  ChartTooltip,  ChartTooltipContent,  ChartLegendContent,  ChartDataTable,  useChart,} from "@/components/ui/chart"

API reference

ChartTooltipContent

PropTypeDefault
activeboolean–
payloadreadonly TooltipPayloadEntry[]–
labelstring | number–
labelKeystring–
nameKeystring–
indicator"dot" | "line" | "dashed""dot"
hideLabelbooleanfalse
hideIndicatorbooleanfalse
colorstring–
labelFormatter(label: ReactNode, payload: readonly TooltipPayloadEntry[]) => ReactNode–
formatter(value: unknown, name: unknown, item: TooltipPayloadEntry, index: number) => ReactNode–
classNamestring–
labelClassNamestring–

Also takes ChartFormatOptions.

ChartLegendContent

PropTypeDefault
classNamestring–
payloadreadonly LegendPayload[]–
verticalAlign"top" | "middle" | "bottom""bottom"
nameKeystring–
hideIconbooleanfalse

ChartDataTable

Takes ChartName &.

ChartStyle

PropTypeDefault
idrequiredstring–
configrequiredChartConfig–

ChartContainer

Takes Omit<ComponentProps<"figure">, "children" | "aria-label" | "aria-labelledby"> &.

Other exports

chartStyleSheetchartSwatchColorformatChartValueresolveChartSeriesChartContextuseChartChartLegendChartTooltiptype ChartConfigtype ChartFormattype ChartFormatOptionstype ChartNametype ChartSeriesConfigtype ChartSeriesThemetype ChartIndicatortype ChartTooltipContentPropstype ChartLegendContentPropstype ChartDataTablePropstype ChartRowtype ChartContainerProps

Accessibility

  • 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.