Updated
Split Bar
Customize
Storage
Installation
npx shadcn@latest add https://uibrik.com/r/split-bar.jsonInstall the packages
npm install @number-flow/react @tabler/icons-react motion react-use-measureAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/split-bar/split-bar.tsx"use client"; import { useEffect, useMemo, useState, type PointerEvent } from "react"; import { motion, useReducedMotion } from "motion/react"; import NumberFlow from "@number-flow/react"; import { cn } from "@/lib/utils"; import { Announce, ChartCard, DataTable, Headline, Tooltip, useChartCursor, useWidth, EASE_OUT, GAP, SETTLE, SERIES_COUNT, seriesColor, tint, TRACK, formatShare, formatValue, type ValueFormat,
Adds the files to
components/uibrik/split-bar and installs @number-flow/react, @tabler/icons-react, motion and react-use-measure. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/split-bar.Too large to paste whole, so Copy prompt gives a short prompt that installs it with the CLI. Download the full prompt to attach it instead.
Usage
import { SplitBar } from "@/components/uibrik/split-bar/split-bar";const items = [ { label: "Photos", value: 38.4 }, { label: "Documents", value: 21.7 }, // …3 more];<SplitBar title="" showList items={items} onSelect={(item) => {}} // total={0} // format={…}/>Where to use Split Bar
Storage breakdowns
Parts of a whole on one bar linked to a list make usage by type clear.
Pairs with Progress
Survey results
Segments sliding to new shares when data changes show shifts in opinion.
Plan or category splits
One bar is more compact than a pie chart in a dashboard card.
Pairs with Ring Stack
Props
SplitBar- title
- Type string
- ""
- Names the whole. Empty uses the sample's name.
- showList
- Type boolean
- true
- List every part under the bar.
- items
- Type { label: string; value: number; color?: string }[]
- –
- The parts, in bar order. Past six, the rest fold into Other.
- total
- Type number
- –
- Full capacity. The rest of the bar shows what's left.
- format
- Type Intl.NumberFormatOptions
- GB for the sample
- Formats every number, e.g. { style: "currency", currency: "USD" }.
- onSelect
- Type (item: SplitItem) => void
- –
- Called with the part picked from the bar or the list.
- className
- Type string
- –
- Classes for the outer shell.