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
45
75
60
90
55
80
65
85
70
MonTueWedThuFriSatSunMonTue
Props
Component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
data* | number[] | — | Values, scaled against max |
animated | boolean | true | Wave animation (pill variant, off with reduced motion) |
variant | 'pill' | 'solid' | 'pill' | Two-tone pill bars or solid bars with rounded tops |
max | number | 100 | Upper bound of the scale |
height | number | 128 | Chart height in pixels |
labels | string[] | — | X-axis labels, one per bar |
showValues | boolean | false | Print each value above its bar |
showGrid | boolean | false | Dashed grid lines behind the bars |
className | string | — | 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 decorativeKeyboard Navigation
| Key | Action |
|---|---|
| N/A | Bar 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