Bar Chart

A customizable bar chart component to visualize your data with support for multiple categories, custom colors, and horizontal alignment. 📊



Installation

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


Examples

Default



Grouped Data



Horizontal Alignment



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 bars
alignment"vertical" | "horizontal""vertical"Orientation of the bars
strokeColorsstring[]["var(--foreground)"]Array of stroke colors for the bars
fillColorsstring[]["var(--primary)"]Array of fill colors for the bars
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