noahgdev

Bar Chart

Dashboards

About

A single-series bar chart for shadcn/ui with gradient or striped fills, a highlighted subset of bars, and a hover marker. Use it for spend by week, signups by day, or anything where one series and a highlighted period tell the story.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Bar Chart to your project and fits it to your theme.

Code

How Bar Chart is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import { BarChart } from "@/components/ui/dashboardcn-bar-chart"
import { formatNumber } from "@/components/ui/dashboardcn-bar-chart"

const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]

const data = months.flatMap((month, m) =>
  Array.from({ length: 4 }, (_, w) => ({
    week: `${month} week ${w + 1}`,
    month,
    spend:
      month === "Mar"
        ? 1_900 + w * 470
        : 900 + Math.round(Math.abs(Math.sin(m * 4 + w)) * 500),
  }))
)

export default function BarChartDemo() {
  return (
    <BarChart
      data={data}
      xKey="week"
      yKey="spend"
      groupKey="month"
      color="var(--color-orange-500)"
      grid="none"
      highlight={(row) => row.month === "Mar"}
      yFormatter={(value) => formatNumber(value, { format: "currency" })}
      tooltipLabel={(row) => String(row.week).replace(/^\w+ /, "")}
    />
  )
}

Dependencies

More by noahgdev

View all
  • Donut Chart

    Donut Chart

    1
  • Metric List

    Metric List

  • Sankey Chart

    Sankey Chart

  • Scatter Chart

    Scatter Chart

  • Radar Chart

    Radar Chart

  • Composed Chart

    Composed Chart

  • Funnel Chart

    Funnel Chart

  • Activity Heatmap

    Activity Heatmap

More in Dashboards

View all
  • Fernly — Project Management Dashboard with Kanban

    Fernly — Project Management Dashboard with Kanban

    659
  • Analytics Dashboard

    Analytics Dashboard

    59
  • Creator Dashboard

    Creator Dashboard

    208
  • Insights Dashboard

    Insights Dashboard

    35
  • serf dashboard

    serf dashboard

    137
  • Corbel — Sales Analytics Dashboard

    Corbel — Sales Analytics Dashboard

    293
  • Dashboard with Collapsible Sidebar

    Dashboard with Collapsible Sidebar

    2.7K
  • Business/Sales Dashboard

    Business/Sales Dashboard

    1.5K