Componentcharts0.62 KB gzipZero dependencies
Stacked Bar Chart
Horizontal stacked bars with segmented rows and legend chips
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add stacked-barOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { StackedBarChart } from "@/components/ui/stacked-bar"; <StackedBarChart rows={rows} />Source code
stacked-bar.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| rows | StackedBarRow[] | Configures rows. (Default: []) |
| height | number | Configures height. (Default: 400) |