GenericCard
A themed KPI metric card that renders a title, a numeric value, and a colour-coded icon. Shadow, border radius, and hover animation come from the active MUI theme automatically.
π StorybookPreviewβ
Live previewβ Open in Storybook
Importβ
import { GenericCard } from "@xocialive/ui-components";
Basic usageβ
import Home from "@mui/icons-material/Home";
<GenericCard title="Total Users" value="1,234" icon={Home} color="primary" />;
Color variantsβ
<GenericCard title="Active" value={987} icon={CheckCircle} color="success" />
<GenericCard title="Failed" value={12} icon={Error} color="error" />
<GenericCard title="Pending" value={34} icon={Warning} color="warning" />
<GenericCard title="Info" value="N/A" icon={Info} color="info" />
Propsβ
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | β | Label shown above the value |
value | string | number | null | undefined | β | Metric value; renders "-" when null/undefined |
icon | React.ElementType | β | MUI SvgIcon component (not an element β pass the class itself) |
color | "primary" | "success" | "error" | "warning" | "info" | "secondary" | "primary" | Palette colour used for the gradient, border, and shadow |
sx | SxProps<Theme> | β | Root Paper style overrides |
Notesβ
- All visual styling (shadow, border radius, hover lift) is derived from the active theme β do not hardcode
boxShadoworborderRadiusviasx. iconexpects the component class (e.g.HomeIcon), not<HomeIcon />.