Componentcharts0.74 KB gzipZero dependencies
Bullet Chart
Target versus actual progress meter with qualitative ranges and goal marker.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add bullet-chartOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { BulletChart } from "@/components/ui/bullet-chart"; <BulletChart label="Ticket Sales" value={780} target={1000} max={1200} unit=" stubs" />Source code
bullet-chart.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxbullet-chart.tsx51 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface BulletChartProps extends React.HTMLAttributes<HTMLDivElement> { label: string; /** Actual value */ value: number; /** Target value */ target: number; max: number; unit?: string;} /** Bullet chart: actual value bar vs target indicator marker. */export function BulletChart({ label = "", value = 0, target = 0, max = 0, unit = "", className, ...props }: BulletChartProps) { const vpct = Math.min(100, (value / max) * 100);Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { BulletChart } from "@/components/ui/bullet-chart"; <BulletChart />| Prop | Type | Description |
|---|---|---|
| label | string | Label of the metric |
| value | number | Actual value |
| target | number | Target value |
| max | number | Maximum scale value |
| unit | string | Unit suffix (e.g. " stubs") |