ページ · Laravilt
Stats Overview
A responsive grid of stat cards with descriptions, icons and sparklines.
StatsOverviewWidget shows a grid of Stat cards.
Basic usage
php
columns() defaults to 3.
Stat
Stat::make(string $label, string|int|float|Closure $value) creates one card. A closure value is evaluated when the widget is rendered, so it re-runs on every poll.
php
Sparklines
chart(array $data, ?string $type = 'bar', ?string $color = null) draws a small chart inside the card. $type is bar (the default) or line:
php
Methods
StatsOverviewWidget
| Method | Description |
|---|---|
stats(array $stats) | The Stat cards |
columns(int $columns) | Grid columns (default 3) |
plus heading(), description(), polling() ... | See shared methods |
Stat
| Method | Description |
|---|---|
make(string $label, string|int|float|Closure $value) | Create a stat (static) |
description(string $description) | Sub-text |
descriptionIcon(string $icon, ?string $color = null) | Icon next to the description |
icon(string $icon) | Card icon (Lucide name, for example Users) |
color(string $color) | Card color |
chart(array $data, ?string $type = 'bar', ?string $color = null) | Sparkline |
url(string $url) | Make the card a link |
Dashboard resource stats
The panel's default Dashboard page adds a stats overview with one card per resource. Turn it off or change its columns in your own dashboard class:
php