{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "bar-chart", "type": "registry:component", "title": "Bar Chart", "description": "Beautiful bar chart for data visualization with retro styling", "dependencies": [ "recharts" ], "files": [ { "path": "components/retroui/charts/BarChart.tsx", "content": "\"use client\"\n\nimport { cn } from \"@/lib/utils\"\nimport React from \"react\"\nimport {\n Bar,\n BarChart as RechartsBarChart,\n CartesianGrid,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\"\n\ninterface BarChartProps extends React.HTMLAttributes {\n data: Record[]\n index: string\n categories: string[]\n strokeColors?: string[]\n fillColors?: string[]\n tooltipBgColor?: string\n tooltipBorderColor?: string\n gridColor?: string\n valueFormatter?: (value: number) => string\n showGrid?: boolean\n showTooltip?: boolean\n stacked?: boolean\n alignment?: \"vertical\" | \"horizontal\"\n className?: string\n}\n\nconst BarChart = React.forwardRef(\n (\n {\n data = [],\n index,\n categories = [],\n strokeColors = [\"var(--foreground)\"],\n fillColors = [\"var(--primary)\", \"var(--secondary)\"],\n tooltipBgColor = \"var(--background)\",\n tooltipBorderColor = \"var(--border)\",\n gridColor = \"var(--muted)\",\n valueFormatter = (value: number) => value.toString(),\n showGrid = true,\n showTooltip = true,\n stacked = false,\n alignment = \"vertical\",\n className,\n ...props\n },\n ref\n ) => {\n return (\n
\n \n \n {showGrid && (\n \n )}\n\n {alignment === \"horizontal\" ? (\n <>\n \n\n \n \n ) : (\n <>\n \n\n \n \n )}\n\n {showTooltip && (\n {\n if (!active || !payload?.length) return null\n\n return (\n \n
\n
\n \n {index}\n \n \n {label}\n \n
\n {payload.map((entry, index) => (\n
\n \n {entry.dataKey}\n \n \n {valueFormatter(entry.value as number)}\n \n
\n ))}\n
\n
\n )\n }}\n />\n )}\n\n {categories.map((category, index) => {\n const fillColor = fillColors[index] || fillColors[0]\n const strokeColor = strokeColors[index] || strokeColors[0]\n\n return (\n \n )\n })}\n \n \n \n )\n }\n)\n\nBarChart.displayName = \"BarChart\"\n\nexport { BarChart, type BarChartProps }", "type": "registry:component", "target": "components/retroui/charts/BarChart.tsx" } ] }