Ballmac UI home

Chart Bar

A bar chart with upright columns or flat bars, grouped, stacked or expanded to 100%, value labels, one color per category, a highlight, negative coloring and sorting, in a frame with a table view, patterns and states.

6/6 checksv1.0.0Updated Oct 18, 2026
What changed

Revenue and costs

April to September

6 points. Revenue: from $18,200 in Apr to $34,600 in Sep; highest $34,600 in Sep, lowest $18,200 in Apr. Costs: from $11,400 in Apr to $15,800 in Sep; highest $15,800 in Sep, lowest $11,400 in Apr.

Installation

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

Usage

import { ChartBar } from "@/components/ballmac/chart-bar"

The full example is in the Code tab above.

Examples

Flat bars with labels

Top pages

Views in the last 30 days

6 points. Views: /pricing 18,420, /docs/get-started/install 15,310, /blocks 12,980.

Stacked

Qualified leads

By source, stacked

4 points. Inbound: from 420 in Q1 to 640 in Q4; highest 640 in Q4, lowest 420 in Q1. Outbound: from 310 in Q1 to 410 in Q4; highest 410 in Q4, lowest 310 in Q1. Partner: from 140 in Q1 to 330 in Q4; highest 330 in Q4, lowest 140 in Q1.

Expanded to 100%

Plan mix by region

Share of accounts on each plan

4 points. Free: from 5,200 in Americas to 1,900 in Africa; highest 6,300 in Asia, lowest 1,900 in Africa. Pro: from 3,100 in Americas to 700 in Africa; highest 3,600 in Europe, lowest 700 in Africa. Team: from 1,200 in Americas to 210 in Africa; highest 1,700 in Europe, lowest 210 in Africa.

Value labels and a highlight

Support tickets

Opened this week

7 points. Tickets: from 42 in Mon to 17 in Sun; highest 73 in Thu, lowest 17 in Sun.
Thursday was the busiest day.

One color per category

Visitors by browser

Each bar has its own color; the legend lists the browsers

5 points. Visitors: Chrome 8,420, Safari 5,130, Firefox 1,980.

Positive and negative

Net cash flow

Money in minus money out

6 points. Net: from $4,200 in May to $5,200 in Oct; highest $6,400 in Aug, lowest −$1,800 in Jun.
Two months were negative.

Ranking

Closed deals

This quarter, by rep

6 points. Closed: Maya Jensen $412k, Tomás Rivera $368k, Aiko Tanaka $331k.

Patterns for color blindness

Contracts by city

Switch Patterns on: each series gets its own texture as well as its color

4 points. Signed: from 128 in Lisbon to 96 in Osaka; highest 172 in Berlin, lowest 96 in Osaka. Pending: from 64 in Lisbon to 49 in Osaka; highest 81 in Berlin, lowest 49 in Osaka. Lost: from 22 in Lisbon to 18 in Osaka; highest 31 in Berlin, lowest 18 in Osaka.

API reference

PropTypeDefault
layout

"columns" stand upright with categories along the bottom. "bars" lie flat with categories down the side, which reads better for long names.

"columns" | "bars""columns"
stack

"stacked" piles the series up; "expanded" shows each one's share of the total.

"none" | "stacked" | "expanded""none"
radius

Corner radius of the bars, in pixels.

number6
labels

Write each bar's value on it. For one series or grouped bars.

booleanfalse
colorBy

With one series, "category" colors every bar differently and the legend lists the categories.

"series" | "category""series"
highlight

A category to emphasize: the others fade.

string—
negativeColor

With one series, color bars below zero differently.

string—
sort

Sort the categories by the first series.

"none" | "ascending" | "descending""none"
gap

Space between bars.

"tight" | "default" | "wide""default"
grid"value" | "both" | "none""value"
valueAxis

Show the value axis. Hide it when `labels` already write the numbers.

booleantrue
axisFormatter

Writes a tick on the value axis. Defaults to a compact number.

(value: number) => string—
domain[number | "auto", number | "auto"]—
referenceLines{ value: number; label: string }[]—
tooltip"dot" | "line" | "dashed" | "none""dot"
value*number—
label*string—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Arrow keysMove between bars (accessibilityLayer)
Tab, Enter / SpaceLegend buttons switch series or categories; the Chart / Table switch shows the numbers as a table

Quality scorecard

6/6

Every applicable check passes

Measured in Chromium 153.0.8010.12 on October 19, 2026, on version 1.0.0, across 9 examples.

How we measure
  • Passed: Accessibility scan

    No serious or critical issues in light and dark, on a phone and a desktop (axe-core 4.13.0, WCAG 2.1 AA and best-practice rules).

  • Passed: Small screens

    No sideways scrolling at 360, 390 or 1280 px wide.

  • Passed: Reduced motion

    No endless animation to begin with.

  • Not applicable: Right to left

    Not mirrored by design: Recharts draws its axes in SVG coordinates, which do not mirror.

  • Passed: Clean console

    No console errors or React hydration errors while loading.

  • Passed: Keyboard

    35 tab stops, each showing a visible change when it takes focus. 2 documented keys.

  • Not applicable: Loading, empty and error

    Does not show data or take submissions.

  • Passed: Automated tests

    Covered by charts-batch-families.test.tsx.

  • For information: Footprint

    3.2 KB of source (gzip) in 1 file. Installs recharts.

Automated checks find a subset of problems and do not replace testing with a screen reader and a keyboard in your own app. What they miss.

Use with AI

<ChartBar title description data xKey series={[{ key, label, color? }]} />. layout: columns | bars (flat, for long names). stack: none | stacked | expanded. Also labels, colorBy ('category' for one color per bar), highlight, negativeColor, sort, gap, valueAxis, axisFormatter, referenceLines, legend, patterns, state and every ChartFrame prop. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Chart Bar (@ballmac/chart-bar) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Comparing values across categories
  • Rankings (layout='bars', sort='descending')
  • Parts of a whole across groups (stack)

Not for

  • A trend over time with many points (use chart-area or chart-line)
  • A single share of a whole (use chart-pie or chart-radial)

Registry JSON: https://ui.ballmac.com/r/chart-bar.json

Credits

Free to use in personal and commercial projects.

Ballmac UI Pro

Need the whole screen, not one piece?

150 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.

Not ready? Try three Pro blocks free

Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.