russellbloxwich

Chart

Dashboards 2

About

A composable chart component built on Recharts with themeable colors, a styled tooltip, and a legend for displaying bar, line, area, and pie chart data.

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

Code

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

Usage.tsx

"use client";

import * as React from "react";
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
} from "@/components/ui/chart";
import * as Recharts from "recharts";

const chartData = [
  { month: "January", requests: 186, errors: 12 },
  { month: "February", requests: 305, errors: 18 },
  { month: "March", requests: 237, errors: 9 },
  { month: "April", requests: 273, errors: 15 },
  { month: "May", requests: 209, errors: 7 },
  { month: "June", requests: 314, errors: 11 },
];

const chartConfig = {
  requests: { label: "Requests", color: "#2563eb" },
  errors: { label: "Errors", color: "#f97316" },
} satisfies ChartConfig;

export default function ChartDemo() {
  return (
    <div className="w-full max-w-xl rounded-lg border bg-card p-6 text-card-foreground">
      <ChartContainer config={chartConfig} className="aspect-video">
        <Recharts.BarChart data={chartData}>
          <Recharts.CartesianGrid vertical={false} />
          <Recharts.XAxis
            dataKey="month"
            tickLine={false}
            axisLine={false}
            tickMargin={8}
            tickFormatter={(value) => value.slice(0, 3)}
          />
          <ChartTooltip content={<ChartTooltipContent />} />
          <Recharts.Bar
            dataKey="requests"
            fill="var(--color-requests)"
            radius={4}
          />
          <Recharts.Bar
            dataKey="errors"
            fill="var(--color-errors)"
            radius={4}
          />
        </Recharts.BarChart>
      </ChartContainer>
    </div>
  );
}

Dependencies

More by russellbloxwich

View all
  • Code Block

    Code Block

    2
  • Sensitive Input

    Sensitive Input

    2
  • Layer Card

    Layer Card

    1
  • Direction Provider

    Direction Provider

    1
  • Switch

    Switch

  • Bubble

    Bubble

  • Meter

    Meter

  • Field

    Field

More in Dashboards

View all
  • Dashboard with Collapsible Sidebar

    Dashboard with Collapsible Sidebar

    2.5K
  • Sidebar

    Sidebar

    286
  • SaaS Template

    SaaS Template

    2.5K
  • Course Design Cards

    Course Design Cards

    1.1K
  • Chat template

    Chat template

    614
  • System Status Block

    System Status Block

    316
  • Statistics Card 7

    Statistics Card 7

    301
  • Bar Chart

    Bar Chart

    1