Skip to content
synccn

Bar Chart

Responsive SVG bars with tooltips and an entrance.

New signups

Up 145% from January to August

Installation

$ pnpm dlx shadcn@latest add @synccn/bar-chart

First time in this project? Connect synccn with one command.

Usage

import { BarChart } from "@/components/ui/charts";<BarChart data={[{ label: "Jan", value: 42 }]} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

BarChart

Responsive bar chart. data: [{ label, value }]

  • datarequired
    ChartDatum[]

    Bars, in order.

  • height
    number

    Default 220

    Chart height in pixels.

  • format
    (value: number) => React.ReactNode

    Default (v) => v

    Formats axis ticks and tooltip values.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Accessibility

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: img, meter
  • ARIA attributes: aria-label, aria-pressed, aria-valuemax, aria-valuemin, aria-valuenow