Animated React charts and dashboard widgets

Metric split

Three metrics on one proportional bar, each with its number counting up on odometer wheels. Switch Week, Month or Year to watch the numbers roll and the segments glide.

Charts, in view, then hover and press, Motion

Install

npm i clsx motion tailwind-merge && curl -o components/metric-split.tsx https://motion-brew.com/r/metric-split.tsx

One self contained file for React and Tailwind CSS: metric-split.tsx. Or ask your AI agent to add it through the MCP server.

Usage

import { MetricSplit } from "@/components/metric-split";

export default function Page() {
  return (
    <MetricSplit
      title="Store traffic"
      metrics={["Visitors", "Add to cart", "Orders"]}
      periods={[
        { label: "Today", values: [820, 140, 36] },
        { label: "Week", values: [5120, 902, 214] },
      ]}
      onAction={() => openReport()}
    />
  );
}

It shows exactly three metrics; the third uses a striped bar so it never relies on shade alone. Columns never shrink below 92px, so labels stay readable; the card is 420px wide by default.

Props

PropTypeDefaultDescription
metricsstring[]visits, page views, downloadsThree metric names, left to right
periodsMetricSplitPeriod[]week, month, year{ label, values } per option on the switch
defaultPeriodstringfirst periodPeriod shown first
colorstring"#8b5cf6"Base color for the three segments and dots
titleReactNode"Site activity"Card title
subtitleReactNode"How people find and use your page"Line under the title
durationnumber1.4Count-up and width glide, seconds
localestring"en-US"Number formatting locale
actionLabelReactNode"View report"Accessible label for the round header button
onAction() => voidHeader button pressed; leave out to hide it

More charts

  • Spending meter: A spending card whose pills fill in turn as the amount counts up on odometer wheels.
  • Goal gauge: A half-ring goal meter split by source.
  • Month calendar: A month view where a soft disc follows your pointer, an ink disc springs to the picked day and months slide the way you travel.
  • Calendar agenda: A day planner: swipe an event left to mark it done and confetti rises out of the card, or right to delete it.

All animated react charts and dashboard widgets