Dashboard Components
Components specifically designed for dashboard pages, including statistics cards and data visualization elements.StatCard
Statistic card component with trend indicators and optional highlighting.Description
Displays a single statistic or metric with:- Large value display
- Title label
- Optional trend percentage with icon
- Optional highlighted state
- Custom icon support
Props
Label text describing the statistic (e.g., “Total Assets”, “Active Maintenance”)
The main statistic value to display
Percentage change value (e.g., 12.5 for +12.5%). Can be positive or negative.
Additional label text to display after the trend percentage (e.g., “vs last month”)
Custom icon component to display (currently not rendered in the component)
When true, applies blue background styling to make the card stand out
Additional CSS classes to apply to the card
TypeScript Interface
Styling States
Default State
- White background
- Gray border
- Gray text for title
- Black text for value
- Blue badge for trend
Highlighted State
- Blue gradient background (
bg-blue-600) - White text throughout
- Enhanced shadow
- Darker blue badge
Usage Example
Trend Display
When atrend prop is provided, the component displays:
- A rounded badge with the trend percentage
- A
TrendingUpicon from Lucide - Automatic ”+” prefix for positive values
- Optional
trendLabeltext
Real-world Implementation
From the GIMA dashboard, this component is typically used in a grid layout:Responsive Design
The card automatically adjusts to container width. Recommended grid breakpoints:Accessibility
- Use descriptive titles that explain the metric
- Ensure sufficient color contrast (particularly with highlighted state)
- Consider adding
aria-labelfor screen readers if needed:
Customization
You can extend the styling using theclassName prop:
Animation
The card includes built-in transitions:- Hover effect on non-highlighted cards
- Smooth shadow transitions
- Duration: 200ms