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"

const data = Array.from({ length: 14 }, (_, i) => {
  const day = i + 1
  const weekend = new Date(2026, 6, day).getDay() % 6 === 0
  return {
    date: `2026-07-${String(day).padStart(2, "0")}`,
    day,
    sessions: weekend ? 40 + i * 2 : 120 + Math.round(Math.abs(Math.cos(i)) * 90),
    weekend,
  }
})

export default function BarChartStripedDemo() {
  return (
    <BarChart
      data={data}
      xKey="date"
      yKey="sessions"
      variant="striped"
      color="var(--color-blue-500)"
      mutedColor="var(--color-blue-500)"
      barRadius={8}
      highlight={(row) => !row.weekend}
      xFormatter={(value) => String(value).slice(-2).replace(/^0/, "")}
      yFormatter={(value) => `${value} sessions`}
    />
  )
}

Dependencies

More by noahgdev

View all
  • Metric List

    Metric List

  • Sankey Chart

    Sankey Chart

  • Scatter Chart

    Scatter Chart

  • Radar Chart

    Radar Chart

  • Donut Chart

    Donut 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