Componentcharts0.74 KB gzipZero dependencies

Bullet Chart

Target versus actual progress meter with qualitative ranges and goal marker.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

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

npx bigbullui add bullet-chart

Or install the full npm package:

npm install bigbullui

Usage

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 helper

Zero 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 />
PropTypeDescription
labelstringLabel of the metric
valuenumberActual value
targetnumberTarget value
maxnumberMaximum scale value
unitstringUnit suffix (e.g. " stubs")