Chart
Data displayPresents numeric comparisons as bars, lines, rings, or ranked rows with companion data-table primitives.
Try it
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/chart.jsonThe command includes the component’s shared dependencies. Your project keeps editable source files.
Include the complete example
This example also composes button, typography. Install its parts together:
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/chart.json https://luv-jeri.github.io/cojeev-ui/r/button.json https://luv-jeri.github.io/cojeev-ui/r/typography.jsonUsing chart
Pass labeled data to Chart or ChartLine, or labeled segments to ChartRing.
Represent missing observations with null values and set a useful caption that describes the comparison.
API
Compose the exported parts below. The prop types are read from the React source during the registry build.
Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.
ChartContainerProps
Accepts the native or primitive props declared by its exported TypeScript type.
ChartProps
| Prop | Type | Required |
|---|---|---|
data | ChartDatum[] | No |
max | number | No |
showTable | boolean | No |
caption | string | No |
ChartBarProps
| Prop | Type | Required |
|---|---|---|
variant | "default" | "pink" | "ink" | "dash" | null | undefined | No |
value | number | Yes |
max | number | No |
ChartAxisProps
Accepts the native or primitive props declared by its exported TypeScript type.
ChartLineProps
| Prop | Type | Required |
|---|---|---|
data | ChartDatum[] | No |
showTable | boolean | No |
caption | string | No |
ChartLinePathProps
| Prop | Type | Required |
|---|---|---|
variant | "hist" | "next" | "cross" | No |
ChartRingProps
| Prop | Type | Required |
|---|---|---|
segments | ChartRingSegment[] | Yes |
strokeWidth | number | No |
gap | number | No |
unit | string | No |
showTable | boolean | No |
draw | boolean | No |
caption | string | No |
ChartRingCenterProps
Accepts the native or primitive props declared by its exported TypeScript type.
ChartRankedRowProps
Accepts the native or primitive props declared by its exported TypeScript type.
ChartRankedLabelProps
Accepts the native or primitive props declared by its exported TypeScript type.
ChartRankedValueProps
Accepts the native or primitive props declared by its exported TypeScript type.
ChartDataTableProps
| Prop | Type | Required |
|---|---|---|
data | ChartDatum[] | Yes |
caption | string | No |
visuallyHidden | boolean | No |
ChartFrameProps
| Prop | Type | Required |
|---|---|---|
data | ChartPoint[] | Yes |
series | ChartSeries[] | Yes |
caption | string | No |
description | string | No |
showTable | boolean | No |
tableVisible | boolean | No |
valueFormatter | (value: number) => string | No |
className | string | No |
legendMode | "series" | "points" | No |
interaction | "x" | "columns" | "y" | "radar" | "shape" | No |
emptyMessage | string | No |
children | (plot: ChartPlotState) => React.ReactNode | Yes |
Accessibility
Keep the default companion data table or supply an equivalent accessible explanation if showTable is false.
Include units and labels so values can be understood without interpreting color or geometry alone.
States and appearance
For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.
Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.