Componentcharts0.62 KB gzipZero dependencies

Stacked Bar Chart

Horizontal stacked bars with segmented rows and legend chips

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add stacked-bar

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { StackedBarChart } from "@/components/ui/stacked-bar"; <StackedBarChart rows={rows} />

Source code

stacked-bar.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxstacked-bar.tsx86 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface StackedBarSegment {  value: number;  color?: string;} export interface StackedBarRow {  label: string;  segments: StackedBarSegment[];} export interface StackedBarProps extends React.HTMLAttributes<HTMLDivElement> {  rows: StackedBarRow[];  height?: number;

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { StackedBar } from "@/components/ui/stacked-bar"; <StackedBar />
PropTypeDescription
rowsStackedBarRow[]Configures rows. (Default: [])
heightnumberConfigures height. (Default: 400)