Charts
Bar list
Who leads: the name sits on its bar, scaled to the leader.
Top car parks this month
- ৳1284kGulshan Car ParkDhaka
- ৳962kBanani Trade CentreDhaka
- ৳641kGEC CircleChattogram
- ৳488kDhanmondi 27Dhaka
- ৳214kZindabazarSylhet
bar-list.tsx
"use client";
import { BarList, ChartCard } from "@waveinno/ui";
import { Building2 } from "lucide-react";
export default function BarListExample() {
return (
<ChartCard title="Top car parks this month" height={232}>
<BarList
format={(v) => `৳${(v / 1000).toFixed(0)}k`}
items={[
{ id: "g", label: "Gulshan Car Park", hint: "Dhaka", value: 1284000, icon: <Building2 /> },
{ id: "b", label: "Banani Trade Centre", hint: "Dhaka", value: 962000, icon: <Building2 /> },
{ id: "gec", label: "GEC Circle", hint: "Chattogram", value: 641000, icon: <Building2 /> },
{ id: "d", label: "Dhanmondi 27", hint: "Dhaka", value: 488000, icon: <Building2 /> },
{ id: "z", label: "Zindabazar", hint: "Sylhet", value: 214000, icon: <Building2 /> },
]}
/>
</ChartCard>
);
}Import#
Everything comes from the package root. The example above uses:
your-component.tsx
import { BarList, ChartCard } from "@waveinno/ui";Props#
Read from the source of this version, so they match the code exactly.
<BarList>
src/components/charts/bar-list.tsx| Prop | Type | Default | Description |
|---|---|---|---|
itemsrequired | BarListItem[] | — | |
format | (v: number) => string | (v) => v.toLocaleString() | |
sort | boolean | true | Largest first (default). Turn off when the order means something else, e.g. a time sequence. |
color | string | "var(--primary-subtle)" | Bar fill; a light tint keeps the label readable on top of it. |
className | string | — |
<ChartCard>
src/components/charts/chart-card.tsx| Prop | Type | Default | Description |
|---|---|---|---|
titlerequired | string | — | |
description | string | — | |
series | SeriesMeta[] | — | |
action | React.ReactNode | — | |
childrenrequired | React.ReactNode | — | |
className | string | — | |
height | number | 240 |
Install#
If the project does not have the package yet, add it, then follow the setup for Next.js or Vite once.
$ npm install @waveinno/ui