Skip to content

Bar chart

Compare one measure across days and scrub any bar for its value.

ChartBarData
npx shadcn@latest add @silicon-ui/bar-chart

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/bar-chart

Manually

  1. Install the dependencies

    npm install motion
  2. Copy these files into your project

    • components/silicon-ui/bar-chart/bar-chart.tsx
    • components/silicon-ui/bar-chart/bar-chart.module.css
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { BarChart } from "@/components/silicon-ui/bar-chart/bar-chart";

API reference

PropTypeDefault
data*BarChartDatum[]—
label*

What is measured, such as "Active minutes". Names the chart for assistive technology.

string—
period*

The range on show, such as "Sep 15–21, 2026". It rests under the headline.

string—
unit

Unit after each value, such as "min".

string""
averageLabel

Headline label at rest, above the average.

string"Daily average"
valueLabel

Headline label while a bar is scrubbed.

string"Total"
categoryLabel

Header of the first column in the data table read by screen readers.

string"Day"
showAverage

Draws the average as a reference line that springs to each new range.

booleantrue
height

Plot height in pixels.

number176
formatValue(value: number) => stringvalue => grouped.format(value)

Dependencies

npm
motion
Registry
silicon-motion-tokens