noahgdev

Metric Value

Dashboards

About

The number formatter used by every card here. It renders currency, percent, compact, and plain numbers, abbreviates large values to K, M, and B, and shows the full value in a tooltip on hover.

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

Code

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

Usage.tsx

import { MetricValue } from "@/components/ui/dashboardcn-metric-value"

export default function MetricValueDemo() {
  return (
    <div className="flex flex-col gap-4 text-2xl font-semibold tracking-tight">
      <div className="flex flex-wrap items-baseline gap-x-6 gap-y-2">
        <MetricValue value={158143} format="currency" maximumFractionDigits={0} />
        <MetricValue value={1234567} />
        <MetricValue value={0.124} format="percent" />
        <MetricValue value={41194} format="currency" maximumFractionDigits={0} />
      </div>
      <p className="text-muted-foreground text-sm font-normal">
        Values from 100,000 up are abbreviated. Hover one to see the full value, or set
        compactFrom to change the threshold.
      </p>
      <div className="flex flex-wrap items-baseline gap-x-6 gap-y-2">
        <MetricValue value={1234567} compactFrom={Infinity} />
        <MetricValue value={41194} format="currency" maximumFractionDigits={0} compactFrom={10_000} />
        <MetricValue value={98} suffix=" ms" compactFrom={10} />
      </div>
    </div>
  )
}

More by noahgdev

View all
  • Donut Chart

    Donut Chart

    1
  • Metric List

    Metric List

  • Sankey Chart

    Sankey Chart

  • Scatter Chart

    Scatter Chart

  • Radar Chart

    Radar Chart

  • Composed Chart

    Composed Chart

  • Bar Chart

    Bar Chart

  • Funnel Chart

    Funnel Chart

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