Stats Group Component
Category: Data Display
The StatsGroup component is used to display grouped statistics in a consistent, accessible layout. It provides a flexible composite component API that allows for customizable stat items with labels, values, and optional secondary stats.
When to Use
- Dashboard metrics: Display key performance indicators, statistics, or analytics
- Summary statistics: Show aggregated data in a scannable format
- Comparison views: Display multiple related metrics side-by-side
General Structure
The component follows this structure:
- StatsGroup - Main container with grid layout
- StatsGroup.Item - Individual stat item container
- StatsGroup.Label - Label text with optional tooltip
- StatsGroup.Value - Main metric value with variable font sizes
- StatsGroup.SecondaryStat - Optional secondary stat below the main metric
Layout Props (Opinionated)
StatsGroupuses a responsive grid that stacks vertically on mobile and horizontally on larger screensStatsGroup.Itemprovides consistent padding and layout- Subcomponents have opinionated layout classes that cannot be overridden
Styling Props (Flexible)
StatsGroup.Valueaccepts asizeprop ("sm","md","lg","xl","2xl","3xl") for font size controlStatsGroup.Labelacceptstooltipprop for additional context
Usage
Basic Stats Group
With Tooltips
Custom Font Sizes
Custom Styling
Apply custom styling to the elements passed as children: