Controls

Segmented Bar

Effect
Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Segmented Bar
Storage by type
  • Photos48 GB45%
  • Apps31 GB29%
  • Music12 GB11%
  • Mail6 GB6%
  • Other9 GB8%

Segmented Bar

One rounded bar split into parts, with each part's value and share below.

Installation

npx shadcn@latest add ikislay/pixel-ui/segmented-bar

How to use

import { SegmentedBar } from "@/components/ui/segmented-bar"
const data = [
{ label: "Photos", value: 48 },
{ label: "Apps", value: 31 },
{ label: "Music", value: 12 },
]
export function Demo() {
return <SegmentedBar label="Storage by type" data={data} format={(n) => n + " GB"} />
}

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
data*
{ label: string; value: number; color?: string }[]

One part per entry, left to right. Colors follow the chart palette in order unless you set one.

label*
string

Names the chart for screen readers and captions its data table.

format
(value: number) => string

Formats values wherever the chart shows them. Defaults to short numbers like 12.4K.

className
string

Merged onto the root element.