Componentcharts0.62 KB gzipZero dependencies
Histogram
Frequency distribution histogram with hover count readout and grow animation.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add histogramOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { Histogram } from "@/components/ui/histogram"; <Histogram bins={[{ id: "1", label: "18:00", count: 45 }, { id: "2", label: "19:00", count: 120 }]} />Source code
histogram.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxhistogram.tsx58 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface HistogramBin { id: string; label: string; count: number;} export interface HistogramProps extends React.HTMLAttributes<HTMLDivElement> { bins: HistogramBin[]; height?: number;} /** Frequency histogram chart: contiguous bars + tooltip hover. */export function Histogram({ bins = [], height = 180, className, ...props }: HistogramProps) {Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { Histogram } from "@/components/ui/histogram"; <Histogram />| Prop | Type | Description |
|---|---|---|
| bins | HistogramBin[] | Array of bins with id, label and count |
| height | number | Chart height in pixels (default 180) |