For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
30
Sponsor

Stat Card

Scrollable stat cards with values, trends, and change indicators.

Revenue
$12,34512.5%
Orders
1,2343.2%
Customers
5678.1%

Installation

$ pnpm dlx shadcn@latest add @mcpcn/stat-card

Usage

import { StatCard, StatCardList } from "@/components/ui/stat-card";
<StatCard>
  <StatCardList />
</StatCard>

Composition

Use the following composition to build an StatCard:

StatCard
├── StatCardItem
└── StatCardList

OpenUI Integration

Install the OpenUI React packages.

pnpm add @openuidev/react-lang zod

Add StatCard to a component library and map it to the installed component.

import { createLibrary, defineComponent } from "@openuidev/react-lang";
import { z } from "zod/v4";
 
import { StatCard, StatCardList } from "@/components/ui/stat-card";
 
const OpenUIStatCard = defineComponent({
  name: "StatCard",
  description:
    "Scrollable stat cards with values, trends, and change indicators.",
  props: z.object({}),
  component: () => (
    <StatCard>
      <StatCardList />
    </StatCard>
  ),
});
 
export const stat_cardLibrary = createLibrary({
  root: "StatCard",
  components: [OpenUIStatCard],
});

For richer generated compositions, define the child primitives separately and connect them with .ref fields. See Defining Components in the OpenUI documentation.

json-render Integration

Install the json-render React packages.

pnpm add @json-render/core @json-render/react zod

Add StatCard to a component catalog and map it to the installed component.

import { defineCatalog } from "@json-render/core";
import { defineRegistry } from "@json-render/react";
import { schema } from "@json-render/react/schema";
import { z } from "zod";
 
import { StatCard, StatCardList } from "@/components/ui/stat-card";
 
export const catalog = defineCatalog(schema, {
  components: {
    StatCard: {
      props: z.object({}),
      description:
        "Scrollable stat cards with values, trends, and change indicators.",
    },
  },
});
 
export const { registry } = defineRegistry(catalog, {
  components: {
    StatCard: () => (
      <StatCard>
        <StatCardList />
      </StatCard>
    ),
  },
});

Use catalog.prompt() to constrain model output, then render the generated spec with the json-render React Renderer. See the json-render Quick Start for the provider and streaming setup.

API Reference

See the Base UI documentation for more information.