Skip to content
Cojeev UI

Chart

Data display

Presents numeric comparisons as bars, lines, rings, or ranked rows with companion data-table primitives.

React · copy into your project · light and dark themes

Try it

Loading preview…

Take it with you

Copy the example, API and usage notes for your editor or AI assistant.

Add to your project

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/chart.json

The 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:

Terminal
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.json

Using 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

PropTypeRequired
dataChartDatum[]No
maxnumberNo
showTablebooleanNo
captionstringNo

ChartBarProps

PropTypeRequired
variant"default" | "pink" | "ink" | "dash" | null | undefinedNo
valuenumberYes
maxnumberNo

ChartAxisProps

Accepts the native or primitive props declared by its exported TypeScript type.

ChartLineProps

PropTypeRequired
dataChartDatum[]No
showTablebooleanNo
captionstringNo

ChartLinePathProps

PropTypeRequired
variant"hist" | "next" | "cross"No

ChartRingProps

PropTypeRequired
segmentsChartRingSegment[]Yes
strokeWidthnumberNo
gapnumberNo
unitstringNo
showTablebooleanNo
drawbooleanNo
captionstringNo

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

PropTypeRequired
dataChartDatum[]Yes
captionstringNo
visuallyHiddenbooleanNo

ChartFrameProps

PropTypeRequired
dataChartPoint[]Yes
seriesChartSeries[]Yes
captionstringNo
descriptionstringNo
showTablebooleanNo
tableVisiblebooleanNo
valueFormatter(value: number) => stringNo
classNamestringNo
legendMode"series" | "points"No
interaction"x" | "columns" | "y" | "radar" | "shape"No
emptyMessagestringNo
children(plot: ChartPlotState) => React.ReactNodeYes

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

resthoverfocusactive

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.