Bar Chart

Bar Chart

Charts
Data Visualization

Animated bar charts with rounded pill design and wave animations for real-time data visualization.

Preview

Two-tone teal bar chart with wave animation

Live

Real-Time Analytics Dashboard

Monitor key metrics, track user engagement, and spot trends instantly.

Static Variant

Bar chart without animation for simple data display

Props

Component API reference

PropTypeDefaultDescription
data*number[]—Values, scaled against max
animatedbooleantrueWave animation (pill variant, off with reduced motion)
variant'pill' | 'solid''pill'Two-tone pill bars or solid bars with rounded tops
maxnumber100Upper bound of the scale
heightnumber128Chart height in pixels
labelsstring[]—X-axis labels, one per bar
showValuesbooleanfalsePrint each value above its bar
showGridbooleanfalseDashed grid lines behind the bars
classNamestring—Additional CSS classes

Usage

Import and implementation examples

import { BarChart } from '@/components/ui/bar-chart'
// Animated two-tone pill bars
<BarChart data={[65, 80, 55, 90, 70, 85, 60]} />
// Solid bars with values, grid and labels
<BarChart
variant="solid"
data={[45, 75, 60, 90]}
labels={['Mon', 'Tue', 'Wed', 'Thu']}
showValues
showGrid
/>

Features

Built-in functionality

  • Wave animation: Smooth wave animation for live data visualization
  • Two-tone design: Gradient bars with distinct top accent section
  • Responsive: Scales to container size and screen width
  • Hover states: Interactive opacity on hover
  • Live indicator: Pulsing dot for real-time data

Accessibility

Accessibility considerations

ARIA Attributes

Uses role="img" for chart containeraria-label describes chart dataIndividual bars are decorative

Keyboard Navigation

KeyAction
N/ABar chart is not interactive by default

Notes

  • Consider providing data table alternative
  • Color is not the only indicator of values
  • Screen readers should announce chart summary