DEV Community


Posted on

Create Stats overview widgets


Filament comes with a "stats overview" widget template, which you can use to display a number of different stats in a single widget, without needing to write a custom view.

Start by creating a widget with the command:

php artisan make:filament-widget StatsOverview --stats-overview
Enter fullscreen mode Exit fullscreen mode

Then return Stat instances from the getStats() method:


namespace App\Filament\Widgets;

use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;

class StatsOverview extends BaseWidget
    protected function getStats(): array
        return [
            Stat::make('Unique views', '192.1k'),
            Stat::make('Bounce rate', '21%'),
            Stat::make('Average time on page', '3:12'),
Enter fullscreen mode Exit fullscreen mode

Now, check out your widget in the dashboard.

Top comments (1)

rupadana profile image

Hi, kindly leave a like and comment if you got new insight! 🔥