Skip to main content

Stats Card

The StatsCard component is a simple card used to highlight a metric, value, and supporting description.

import { StatsCard } from "tawuniya/components";

👉 View in Storybook

Props​

PropTypeDefaultDescription
iconReactNode-Optional icon displayed above the title.
titlestring-Main metric title or heading.
subTitleReactNode-Supporting number or secondary text.
descriptionReactNode-Additional context or explanation.
classNamesStatsCardClassNames-Custom classes for wrapper, text, and icon sections.

StatsCardClassNames​

interface StatsCardClassNames {
wrapper?: string;
title?: string;
subTitle?: string;
description?: string;
icon?: string;
}

Usage​

Basic example​

<StatsCard
icon={<Icon name="car" className="size-6 [&>path]:stroke-primary" />}
title="Total Policies"
subTitle="1,250"
description="Compared to last month"
/>

With custom classes​

<StatsCard
title="Renewal Rate"
subTitle="94%"
description="Strong performance"
classNames={{
wrapper: "border border-primary/20 bg-primary/5",
title: "text-primary",
subTitle: "text-primary font-bold",
description: "text-muted-foreground",
icon: "size-7 text-primary",
}}
/>

Features​

  • Minimal metric card layout for dashboards and summaries
  • Supports icons, subtitle, and supporting text
  • Custom class support via classNames
  • Works well for KPI, overview, and performance panels