Line Chart

A customizable line chart component to visualize trends and data over time with smooth curves and data points. 📉



Installation

pnpm dlx shadcn@latest add 'https://retroui.dev/r/line-chart.json'


Examples

Default



Multiple Lines



API Reference

PropTypeDefaultDescription
dataRecord<string, any>[][]Array of data objects to display
indexstring-Key for the x-axis (category) data
categoriesstring[][]Array of keys for the data values to display as lines
strokeColorsstring[]["var(--foreground)"]Array of stroke colors for the lines
strokeWidthnumber2Width of the line strokes
dotSizenumber4Size of the data point dots
tooltipBgColorstring"var(--background)"Background color for tooltips
tooltipBorderColorstring"var(--border)"Border color for tooltips
gridColorstring"var(--muted)"Color for the grid lines
valueFormatter(value: number) => string(value) => value.toString()Function to format values
showGridbooleantrueWhether to show grid lines
showTooltipbooleantrueWhether to show tooltips on hover
classNamestring-Additional CSS classes

Last Updated: 12 Aug, 2025