russellbloxwich

Chart

Dashboards 5

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
  • Sensitive Input

    Sensitive Input

    6
  • Code Block

    Code Block

    5
  • Layer Card

    Layer Card

    3
  • Meter

    Meter

    2
  • Field

    Field

    2
  • Direction Provider

    Direction Provider

    2
  • Toast Notifications

    Toast Notifications

    2
  • Combobox

    Combobox

More in Dashboards

View all
  • Creator Dashboard

    Creator Dashboard

    94
  • serf dashboard

    serf dashboard

    83
  • 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

    572
  • Sidebar

    Sidebar

    422
  • Stat Card

    Stat Card

    78