BarChart

Bars grow in a wave. The pointed bar lights up and its value pops above it. Charts.

Open playground
Jan
Feb
Mar
Apr
May
Jun
$3,340
Jul

About

BarChart is a React component in the Charts category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { BarChart } from "@ashutoshswamy/smoui" and set data, height, highlight among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { BarChart } from "@ashutoshswamy/smoui";

<BarChart data={[{ label: "Jan", value: 1240 }, { label: "Feb", value: 1810 }]} />

Props 4

data

Bars.

{ label: string; value: number }[]
height

Bar area height in px.

numberdefault 180
highlight

Bar that holds the highlight. Defaults to the tallest.

number
prefix / suffix

Wrap the value. Or pass `format` as a function.

string