Bar Chart
A rounded bar chart with smooth animations, touch scrubbing, and responsive layout.
// SYSTEM.STAGE
Installation
Install the component and its peer dependencies automatically via the CLI:
// SYS.USAGE
Drop this code into your screen or view:
1import BarChart from "@/components/bar-chart";2 3export default function AnalyticsScreen() {4 const chartData = [5 { label: "Mon", value: 1200 },6 { label: "Tue", value: 2180 },7 { label: "Wed", value: 1850 },8 { label: "Thu", value: 2900 },9 { label: "Fri", value: 2400 },10 { label: "Sat", value: 3800 },11 { label: "Sun", value: 3100 },12 ];13 14 return (15 <BarChart16 data={chartData}17 theme="dark"18 accentColor="#32C798"19 chartHeight={175}20 animated={true}21 onSelectBar={(point, index) => {22 console.log("Selected point:", point, "at index:", index);23 }}24 />25 );26}// SPEC.PROPS_API
Configurable interfaces for <BarChart />
| PROP_IDENTIFIER | TYPE_SIGNATURE | DEFAULT_VAL | TELEMETRY_NOTES |
|---|---|---|---|
| data | BarChartDataPoint[] | SAMPLE_DATA | Array of chart data points with label, value, and optional secondaryValue or date. |
| theme | "dark" | "light" | "dark" | Color theme mode for background surfaces, text, and track borders. |
| accentColor | string | "#32C798" | Primary accent color for active bars, highlights, and gradient fills. |
| title | string | "Activity Overview" | Header title displayed at the top of the chart card. |
| valuePrefix | string | "" | Optional prefix formatted before numeric values (e.g. '$'). |
| valueSuffix | string | "" | Optional suffix formatted after numeric values (e.g. ' hrs', ' km'). |
| chartHeight | number | 175 | Height of the SVG chart visualization in pixels. |
| animated | boolean | true | Whether to animate bar heights with a staggered spring animation on mount. |
| showBackgroundTrack | boolean | true | Whether to display subtle background slot tracks behind each bar. |
| onSelectBar | (point: BarChartDataPoint, index: number) => void | undefined | Callback fired when a bar is pressed or hovered. |
Array of chart data points with label, value, and optional secondaryValue or date.
SAMPLE_DATAColor theme mode for background surfaces, text, and track borders.
"dark"Primary accent color for active bars, highlights, and gradient fills.
"#32C798"Header title displayed at the top of the chart card.
"Activity Overview"Optional prefix formatted before numeric values (e.g. '$').
""Optional suffix formatted after numeric values (e.g. ' hrs', ' km').
""Height of the SVG chart visualization in pixels.
175Whether to animate bar heights with a staggered spring animation on mount.
trueWhether to display subtle background slot tracks behind each bar.
trueCallback fired when a bar is pressed or hovered.
undefined// PERFORMANCE_&_A11Y
Native touch gestures, screen reader attributes, and 60–120 FPS frame budgets: