Skip to content
SENVENLI UI

Chart parts

The shared frame (with its data table), legend and tooltip the charts are built from, plus the CHART_COLORS series palette, for a custom chart.
A custom chart
import {
  ChartFrame,
  ChartLegend,
  ChartTooltip,
  ChartAnimation,
} from "@senvenli/react/charts";

Examples

Nothing to draw

The frame keeps the chart's height and says why it is empty.

Guidelines

When to use it

  • Building a chart the library does not have, so it looks and reads like the others.

Use something else when

  • Bars and lines on one plot cover the need without custom parts. Composed chart
  • A standard chart is enough. Bar chart

Accessibility

Built in

  • A "Show as table" button shows the same data as a table, which screen readers get by default.

You provide

  • A title that says what the figure is.

API reference

ChartFrame

heightRequired
number

The chart's height in px: loading, empty and the plot all keep it.

isLoading
boolean
emptyState
React.ReactNode

Shown instead of the plot when there is nothing to draw (a compact EmptyState); null while there is data.

dataTableRequired
ChartDataTable<T>

The same data as a compact Table: always there for screen readers, shown on request. Cells are values: a render that returns text (a formatted figure) is used; anything else falls back to the raw value in the hidden table.

legend
React.ReactNode

The Legend: above the plot, or below it (LineChart).

legendPlacement
"top" | "bottom"Default "top"
childrenRequired
React.ReactNode

The Recharts chart (inside a ResponsiveContainer), named by the table's caption. Its keyboard layer (arrow keys move between data points, the tooltip follows) stays on; the table carries the data in full.

ChartLegend

itemsRequired
readonly ChartLegendItem[]
hidden
ReadonlySet<string>

From useChartSeries(): pressing a key hides or shows its series. Leave out for a static legend.

onToggle
(key: string) => void

ChartTooltip

active
boolean

Set by Recharts when used as <Tooltip content={<ChartTooltip … />} />.

payload
readonly ChartTooltipEntry[]
label
{}
valueFormatter
ChartValueFormatterDefault String

Shared with the chart: "€ 55,0k".

labelFormatter
(label: unknown) => ReactNode

The period title ("August 2026"); the category label by default.

labels
Readonly<Record<string, string>>

Series names by data key ("2026", "Website").

change
(payload: readonly ChartTooltipEntry[]) => { label: string; value: string; tone: "success" | "danger" | "neutral" } | null

An optional change row, colored by meaning ("Change +11.8%").

ChartAnimation

isEnabledRequired
boolean
childrenRequired
React.ReactNode