Skip to content

Share Bar

One bar of thin ticks that splits a total into parts, ranked largest first. Breakdown slides each part into its own row and Collapse plays it back; point at a part and the headline reads its figure.

On this page
Used for
  • Spend by agent
  • Tokens by model
  • Traffic by source
  • Storage by folder

Examples

Data

Installation

Installation is part of Pro

Pro components install from a licensed registry. The live preview stays open to everyone.

Props

items
{ key, label, value, color? }[]
The parts. Ranked largest first; zero, negative and non-finite values are left out. Colours default to the chart palette (--chart-1 to --chart-5).
expanded / defaultExpanded / onExpandedChange
boolean / (expanded) => void
Defaultfalse
Show each part in its own row. Controlled or uncontrolled. The toggle is hidden when there is only one part.
title / caption
ReactNode
Default - / "Total"
A label above the headline, and the line under it while nothing is pointed at. Pointing at a part shows its name and share instead.
format / locale
(value) => string / string
Defaultlocale number format
How values are written in the headline, the rows and the table. Percentages use the locale.
a11y
button, table
The toggle is a disclosure button (aria-expanded). Each part is a focusable button named with its label, value and share, and a hidden table lists every part.

What it handles

  1. 01Ranks the parts largest first, so the bar and the rows always read in the same order.
  2. 02Draws each part as thin ticks in its own hue from the theme chart colours, with a minimum so a tiny part stays visible.
  3. 03Slides each part into its own row for Breakdown and back for Collapse, with the same width on both sides.
  4. 04Reads a part when you point at it, focus it with Tab or touch it: the others dim, the headline and the caption follow.
  5. 05Leaves out zero, negative and missing values instead of drawing a gap.
  6. 06Keeps a hidden table of every part with its value and share for screen readers.

States

Open
Each part slides to its row, the bar's space grows to fit
280ms, ease in-out, up to 4 steps of 40ms
Close
The rows fade, each part slides back into the bar
280ms, ease in-out
Point
The other parts dim, the headline digits roll to this part
120ms dim, 280ms roll
First render
The ticks fade in once
120ms, opacity only
Reduced motion
Every change lands at once, no movement
0ms

Works with

When to use

When to use

  • Splitting one total into a few parts: cost by agent, tokens by model, traffic by source.
  • A card that reads at a glance and opens into a ranked list when someone asks.

When not to use

  • Spend against a plan limit, with quotas and a reset date: use Usage Meter.
  • A trend over time: use Chart.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Share Bar to my app and wire it to my own data.
  • I need splitting one total into a few parts: cost by agent, tokens by model, traffic by source. Set that up with the Knowns UI Share Bar.
  • Which Share Bar props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "share-bar" }) and search_docs({ query: "share bar" }). Pro props, full examples and source come back once your license key is in the MCP config.

Need help?

Stuck on Share Bar, or found something off? We read every message.