byDefaultHuman
Components

Bar Chart

A hand-drawn bar chart with hachure-filled bars and animated mount.

Installation

package manager
npx shadcn add https://bydefaulthuman.fun/r/bar-chart.json

Props

PropTypeDefaultDescription
animateOnMount
boolean
true
Animates the component when it first renders.
axisLabel
string
Controls the `axisLabel` behavior.
data*
BarChartDataPoint[]
Data used to render the component.
formatValue
(v: number) => string
Formats the displayed numeric value.
height
number
240
Sets the rendered height in pixels.
id
string
Optional stable id used for sketch seeding and accessibility.
showGrid
boolean
true
Shows background grid lines.
showValues
boolean
true
Controls the `showValues` behavior.
theme
CrumbleTheme
Overrides the global Crumble theme for this instance.

Custom colors and format

Per-bar colors via the color field. formatValue must come from a client component — it cannot be an inline arrow function in MDX.

Accessibility

Charts are visual summaries, so do not rely on them as the only place important numbers appear. Provide nearby text or a data table when exact values matter for decision-making.

Examples

import { BarChart } from "@/components/crumble/ui/bar-chart";

<BarChart
  data={[
    { label: "Mon", value: 40 },
    { label: "Tue", value: 65 },
    { label: "Wed", value: 55 },
    { label: "Thu", value: 80 },
    { label: "Fri", value: 70 },
  ]}
/>;