Reactolith UI Getting Started Introduction Installation Usage Layout Aspect Ratio Card Resizable Scroll Area Separator Direction Provider Forms Button Button Group Calendar Checkbox Combobox Field Input Input Group Input OTP Label Native Select Radio Group Select Slider Switch Textarea Toggle Toggle Group Data Display Accordion Avatar Badge Carousel Chart Collapsible Item Kbd Table Feedback Alert Empty Progress Skeleton Sonner Spinner Overlay Alert Dialog Context Menu Dialog Dropdown Menu Hover Card Popover Sheet Tooltip Navigation Breadcrumb Command Menubar Navigation Menu Pagination Sidebar Tabs

Chart

Beautiful and responsive charts built with Recharts.

Preview

Usage

<ui-chart-container json-config='{"desktop":{"label":"Desktop","color":"hsl(var(--chart-1))"},"mobile":{"label":"Mobile","color":"hsl(var(--chart-2))"}}'>
  <ui-bar-chart json-data='[{"month":"Jan","desktop":186,"mobile":80},{"month":"Feb","desktop":305,"mobile":200},{"month":"Mar","desktop":237,"mobile":120}]'>
    <ui-cartesian-grid json-vertical="false" />
    <ui-x-axis dataKey="month" json-tickLine="false" json-axisLine="false" json-tickMargin="8" />
    <ui-chart-tooltip>
      <ui-chart-tooltip-content />
    </ui-chart-tooltip>
    <ui-bar dataKey="desktop" fill="var(--color-desktop)" json-radius="4" />
    <ui-bar dataKey="mobile" fill="var(--color-mobile)" json-radius="4" />
  </ui-bar-chart>
</ui-chart-container>

Sub-components

<ui-chart-container> <ui-chart-tooltip> <ui-chart-tooltip-content> <ui-chart-legend> <ui-chart-legend-content> <ui-bar-chart> <ui-line-chart> <ui-area-chart> <ui-pie-chart> <ui-radar-chart> <ui-radial-bar-chart> <ui-bar> <ui-line> <ui-area> <ui-pie> <ui-radar> <ui-radial-bar> <ui-x-axis> <ui-y-axis> <ui-cartesian-grid> <ui-polar-grid> <ui-polar-angle-axis> <ui-polar-radius-axis> <ui-cell> <ui-label-list>

Props

<ui-chart-container>

PropTypeDefaultDescription
configChartConfigChart configuration object. Use json-config for HTML.

<ui-chart-tooltip-content>

PropTypeDefaultDescription
hideLabelbooleanfalseHide the label in the tooltip.
hideIndicatorbooleanfalseHide the indicator in the tooltip.

<ui-bar-chart>

PropTypeDefaultDescription
dataobject[]Chart data array. Use json-data for HTML.

<ui-line-chart>

PropTypeDefaultDescription
dataobject[]Chart data array. Use json-data for HTML.

<ui-area-chart>

PropTypeDefaultDescription
dataobject[]Chart data array. Use json-data for HTML.

<ui-bar>

PropTypeDefaultDescription
dataKeystringThe key of data for the bar.
fillstringFill color.
radiusnumberBorder radius.

<ui-line>

PropTypeDefaultDescription
dataKeystringThe key of data for the line.
strokestringStroke color.

<ui-area>

PropTypeDefaultDescription
dataKeystringThe key of data for the area.
fillstringFill color.
strokestringStroke color.

<ui-pie>

PropTypeDefaultDescription
dataKeystringThe key of data for the pie.
dataobject[]Pie data array. Use json-data for HTML.

<ui-radar>

PropTypeDefaultDescription
dataKeystringThe key of data for the radar.

<ui-radial-bar>

PropTypeDefaultDescription
dataKeystringThe key of data for the radial bar.

<ui-x-axis>

PropTypeDefaultDescription
dataKeystringThe key for axis labels.

<ui-cartesian-grid>

PropTypeDefaultDescription
verticalbooleantrueShow vertical grid lines.
horizontalbooleantrueShow horizontal grid lines.

<ui-polar-angle-axis>

PropTypeDefaultDescription
dataKeystringThe key for angle axis labels.

<ui-cell>

PropTypeDefaultDescription
fillstringFill color for the cell.

<ui-label-list>

PropTypeDefaultDescription
dataKeystringThe key of data for labels.
positionstringLabel position.

All components also accept standard HTML attributes (class, id, style, data-*, aria-*, etc.) which are passed through to the underlying element.