import { StatCard, StatCardDelta, StatCardDescription, StatCardEyebrow, StatCardHeader, StatCardLabel, StatCardMetric, StatCardValue } from "@ai-ui/ui"; import type { Meta, StoryObj } from "@storybook/react"; function RevenueStatCard({ interactive = true, tone = "default" }: { interactive?: boolean; tone?: "default" | "subtle" | "accent"; }) { return ( Revenue pulse Monthly recurring revenue $101,820 +8.4% Assisted follow-up and steadier route timing are lifting close quality this month. ); } const meta = { title: "Components/StatCard", component: RevenueStatCard, parameters: { docs: { description: { component: "StatCard is the compact KPI surface for one headline metric, one supporting delta, and one short line of context. Use it when a dashboard needs a readable value slab without the extra regions that belong to a richer analytics panel. The default treatment stays lightly hover-ready so high-value summaries feel like lit objects instead of flat admin tiles." } }, layout: "centered" }, tags: ["autodocs"] } satisfies Meta; export default meta; type Story = StoryObj; export const Playground: Story = {}; export const Motion: Story = { parameters: { docs: { description: { story: "Hover the interactive cards directly in the canvas. StatCard motion should stay compact: the slab lifts as one object, the value sharpens slightly, and the delta chip follows with a softer secondary response instead of turning the panel into a busy dashboard tile." } } }, render: () => (

Motion review

Keep the KPI slab buoyant, not theatrical.

The card should read like one lifted object. The headline value and delta chip can echo the lift, but the motion should still feel quieter than the richer choreography used by MetricCard.

Pipeline pulse Qualified expansion forecast 31% +9.2% The uplift signal is strong enough to justify a wider follow-up wave this week.
) }; export const States: Story = { render: () => (
Risk watch Qualified pipeline $82,450 -3.1% Mid-market deal spread is still wider than the board would like. AI influence Forecast confidence 31% +9.2% Commercial planning is stable enough to expand the next follow-up wave.
) }; export const Anatomy: Story = { render: () => (

Stat card anatomy

The contract stays intentionally small: framing copy, one metric group, and one line of context. If the panel needs media, actions, or footer detail, move up to MetricCard.

data-slot="header" groups the eyebrow and label.

data-slot="metric" holds the headline value and its delta badge.

data-slot="value", data-slot="delta", and data-slot="description" keep KPI styling hooks stable for docs and consumers.

data-interactive keeps the hover-ready treatment explicit when the stat should feel more lifted than surrounding utility panels.

) }; export const Accessibility: Story = { parameters: { docs: { description: { story: "Keep stat-card labels concrete, keep delta color from being the only signal, and reserve the description for the reason the number matters right now rather than repeating the value." } } }, render: () => (

Review guidance

Use a label that names the metric, not just a vague business area.

Delta should still be readable as text such as +8.4% or -3.1%.

Use the chip tone and shape as reinforcement, not as the only signal that the number moved.

The description should explain the current signal, not restate the number.

) };