Mark Yo

Bar Chart

Dashboards

About

An animated SVG bar chart for comparing values across categories, with grouped or stacked bars, a hover tooltip, legend and keyboard-readable data table.

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/chart-bar";
import { TrendingUp } from "lucide-react";

const data = [
  { month: "Jan", desktop: 186, mobile: 80 },
  { month: "Feb", desktop: 305, mobile: 200 },
  { month: "Mar", desktop: 237, mobile: 120 },
  { month: "Apr", desktop: 73, mobile: 190 },
  { month: "May", desktop: 209, mobile: 130 },
  { month: "Jun", desktop: 214, mobile: 140 },
];

export default function BarChartDemo() {
  return (
    <div className="flex w-full min-w-0 justify-center px-4 py-12">
      <div className="w-full max-w-xl rounded-xl border border-border bg-card text-card-foreground">
        <div className="grid gap-1 p-5 pb-2">
          <p className="font-semibold leading-none">Visitors by device</p>
          <p className="text-sm text-muted-foreground">January – June 2026</p>
        </div>
        <div className="px-5 pt-4">
          <BarChart
            data={data}
            index="month"
            series={[
              { key: "desktop", label: "Desktop" },
              { key: "mobile", label: "Mobile" },
            ]}
            title="Monthly visitors by device, January to June 2026"
          />
        </div>
        <div className="grid gap-1.5 p-5 pt-3 text-sm">
          <p className="flex items-center gap-2 font-medium leading-none">
            Trending up by 5.2% this month <TrendingUp className="size-4" />
          </p>
          <p className="leading-none text-muted-foreground">
            Showing total visitors for the last 6 months
          </p>
        </div>
      </div>
    </div>
  );
}

Dependencies

More by Mark Yo

View all
  • Loader

    Loader

    65
  • Pricing Table

    Pricing Table

    24
  • Bento Grid

    Bento Grid

    8
  • Expandable Tabs

    Expandable Tabs

    3
  • Image Gallery

    Image Gallery

    3
  • CTA Section

    CTA Section

    2
  • Wallet Card

    Wallet Card

    1
  • Shared Layout Background

    Shared Layout Background

    1

More in Dashboards

View all
  • Creator Dashboard

    Creator Dashboard

    84
  • serf dashboard

    serf dashboard

    78
  • Dashboard with Collapsible Sidebar

    Dashboard with Collapsible Sidebar

    2.6K
  • Glass Dashboard

    Glass Dashboard

    1.1K
  • Adjustable Glass Dashboard

    Adjustable Glass Dashboard

    1.2K
  • App Dashboard Layout

    App Dashboard Layout

    564
  • Chart Component

    Chart Component

    46
  • Glass Smart Home Dashboard

    Glass Smart Home Dashboard