Bar Chart
Fixed categories, compared by height — the safest default.
<div style={{ width: '100%', height: 300 }}>
<ChartContainer
config={{
sessions: { label: 'Sessions', color: 'var(--fui-color-accent)' },
}}
>Plots your data with tooltips, legends, and colors that track the theme.
import { Chart } from "@/fragments/ui";Source<div style={{ width: '100%', height: 300 }}>
<ChartContainer
config={{
revenue: { label: 'Revenue', color: 'var(--fui-color-accent)' },
users: { label: 'Users', color: 'var(--fui-color-info)' },
}}npx @usefragments/cli add chartpnpm add rechartsWrites src/fragments/ui/components/Chart plus what it imports, the globals stylesheet, and .fragments/registry-lock.json, then prints the packages to add. No account, no key.
Your own registry: publish from Fragments Cloud and add --registry org/name. Connect a workspace.
Chart is a compound: import the root and reach its parts through dot notation.
Chart.TooltipChart.TooltipContentChart.LegendChart.LegendContentChart.preloadFixed categories, compared by height — the safest default.
<div style={{ width: '100%', height: 300 }}>
<ChartContainer
config={{
sessions: { label: 'Sessions', color: 'var(--fui-color-accent)' },
}}
>The fill under the line stresses volume, not just direction.
<div style={{ width: '100%', height: 300 }}>
<ChartContainer
config={{
revenue: { label: 'Revenue', color: 'var(--fui-color-accent)' },
}}
>Parts of one whole — keep it under six slices or it stops reading.
<div style={{ width: '100%', height: 300 }}>
<ChartContainer
config={{
Chrome: { label: 'Chrome', color: 'var(--fui-color-accent)' },
Firefox: { label: 'Firefox', color: 'var(--fui-color-info)' },
Safari: { label: 'Safari', color: 'var(--fui-color-success)' },Prop | Type | Default | Description |
|---|---|---|---|
configRequired | object | Not set | ChartConfig mapping data keys to labels/colors (optional icon per series) |
childrenRequired | element | Not set | A recharts chart component (LineChart, BarChart, etc.) |
summary | string | Not set | Non-visual summary announced to assistive technology users |
dataTable | node | Not set | Optional accessible data table or textual fallback |
style | object | Not set | — |