Stat Cards plugin screenshot
Dark mode ready
No multilingual support
Supports v5.x

Stat Cards by Muhammad Amjad

Community

Richer stat cards for the Filament stats overview widget, adding progress bars, icon tiles, background, label and value colours, trends, badges and bar charts to the widget you already have.

Tags: Widget
Supported versions:
5.x 4.x
Muhammad Amjad avatar Author: Muhammad Amjad

Package health

Automated checks of this plugin's Composer package

92 / 100
Security 85
Maintenance 100
Ecosystem 100
15 checks
  • Skipped: GitHub Actions pinned to SHA
  • Skipped: GitLab CI includes pinned to SHA
  • Passed: Open security advisories
  • Passed: Dependabot PR responsiveness — No open Dependabot PRs.
  • Skipped: Renovate MR responsiveness
  • Skipped: Dependabot or Renovate configured
  • Skipped: Dependency update cooldown configured
  • Failed: Provides a security policy — View details on Plumb
  • Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
  • Passed: Commit and release recency — Active: last commit 0 days ago; last release 0 days ago.
  • Passed: composer.lock not committed by library — composer.lock is absent from the released dist archive.
  • Passed: Dist archive is lean
  • Passed: Current Laravel version supported — Package dependencies resolve together with current Laravel 13.0.
  • Passed: Current PHP version supported — Constraint ^8.2 supports current PHP 8.5.
  • Skipped: Current Symfony version supported
Third-party plugin. This is built by the community, not the Filament team. Filament does not review, endorse, or vet the security of plugins outside the filament/ namespace. Review the source and install at your own risk. Found malware or an unresolved security issue the author won't address? Report it .
Powered by Plumb Last scanned 4 days ago

Documentation

Stat Cards: richer stats overview widgets for Filament

Richer stat cards for the Filament stats overview widget: progress bars, icon tiles, background, label and value colours, trends, badges and bar charts. It works with Filament 4 and 5, inside the StatsOverviewWidget you already have.

Docs: amjad.com.pk/filament/plugins/filament-stat-cards

Latest Version PHP Version License

Stat cards with icon tiles, trends, progress bars and a bar chart in a Filament panel

The same stat cards in dark mode

#What it does

Filament's Stat shows a label, a value, a description and a sparkline. This package's Stat is a subclass of it, so everything core does still works, and it adds:

  • Progress bars, with a custom maximum and an optional label ("72%" or your own text).
  • Icon tiles: the icon in a coloured square, at the start of the label row or at the far end of the card.
  • Colours for the card background, the icon, the label, the value and the description.
  • Trends: give it the current and previous numbers and it writes "12.4% increase" with an arrow, green when the change is good and red when it is bad (or the other way round for refunds, churn and errors).
  • Badges next to the label ("Live", "Beta", "This month").
  • Bar charts as well as core's line sparkline. The bars are plain SVG, with no JavaScript.

There is no new widget class and no Livewire component to register. You change one use line in a widget you already have.

#Requirements

  • PHP 8.2+
  • Laravel 12 or 13
  • Filament 4 or 5

#Installation

composer require amjadiqbal/filament-stat-cards

That is all. The service provider is discovered automatically. No theme, Tailwind config or npm run build is needed: the styles are plain CSS. If you run php artisan filament:assets (Filament's installer adds it to Composer's post-autoload-dump), the panel links the published stylesheet. If you don't, the same CSS (about 5 KB) is printed inline in the panel's <head>.

#Usage

Swap the import in any stats overview widget:

- use Filament\Widgets\StatsOverviewWidget\Stat;
+ use AmjadIqbal\FilamentStatCards\Stat;
use AmjadIqbal\FilamentStatCards\Stat;
use Filament\Widgets\StatsOverviewWidget;

class SalesOverview extends StatsOverviewWidget
{
    protected function getStats(): array
    {
        return [
            Stat::make('Revenue', '$48,200')
                ->icon('heroicon-o-banknotes')
                ->iconBackgroundColor('primary')
                ->iconPosition('end')
                ->trend(48200, 42880)            // "12.4% increase", green, arrow up
                ->progress(48200, 60000)         // 80% of the monthly target
                ->progressLabel('80% of the $60k target')
                ->badge('This month', 'primary'),

            Stat::make('Refunds', '31')
                ->icon('heroicon-o-receipt-refund')
                ->iconColor('danger')
                ->trend(31, 40, higherIsBetter: false) // "22.5% decrease", green
                ->chart([4, 9, 6, 12, 8, 14])
                ->chartType('bar')
                ->chartColor('danger'),

            Stat::make('New signups', '1,204')
                ->backgroundColor('info')
                ->valueColor('info')
                ->description('Since Monday')
                ->chart([1, 3, 2, 5, 4, 6]),        // core's line sparkline
        ];
    }
}

Core Stat objects and these ones can sit in the same widget.

#All methods

Everything on core's Stat (description(), descriptionIcon(), descriptionColor(), color(), chart(), chartColor(), icon(), url(), extraAttributes() …) works as before. Added:

Method What it does
progress($value, $max = 100) Progress bar filled to $value / $max, clamped to 0-100%. Accepts closures.
progressBarColor($color) / progressColor($color) Bar colour. Defaults to the stat's color(), then primary.
progressLabel(true | string) true shows the percentage under the bar; a string shows that text.
iconBackgroundColor($color) Shows the icon in a coloured tile.
iconColor($color) Colours the icon (and overrides the tile's icon colour).
iconPosition('start' | 'end') start (default) is before the label, as in core. end is at the far end of the top row. before/after and IconPosition also work.
backgroundColor($color) Tints the card. In dark mode the card keeps its neutral surface and gets a coloured top line.
labelColor($color), valueColor($color) Text colours.
textColor($label, $value, $description) All three at once; pass null to skip one.
trend($current, $previous, $higherIsBetter = true, $precision = 1) Writes the description, icon and colour from the change. Your own description(), descriptionIcon() or descriptionColor() still wins.
badge($text, $color = null) A small badge after the label. Colour defaults to the stat's color(), then gray.
chartType('line' | 'bar') line is core's sparkline; bar draws the same data as columns.

Colours are any Filament colour name (primary, success, warning, danger, info, gray, or one you registered) or a palette array such as Color::Sky or Color::hex('#0ea5e9').

#Translations

The trend and progress texts are translatable. Publish them with:

php artisan vendor:publish --tag=filament-stat-cards-translations

#Coming from eightynine/filament-advanced-widgets

eightynine/filament-advanced-widgets (MIT, by Eighty Nine) popularised these cards and supports Filament 3 and 4. Stat Cards is a separate, independent implementation for Filament 4 and 5 that accepts the same stat method names (backgroundColor, progress, progressBarColor, iconBackgroundColor, iconColor, iconPosition, labelColor, valueColor, textColor, descriptionIcon, descriptionColor, chartColor). To move a stats widget across:

  1. Replace use EightyNine\FilamentAdvancedWidget\AdvancedStatsOverviewWidget\Stat; with use AmjadIqbal\FilamentStatCards\Stat;.
  2. Replace use EightyNine\FilamentAdvancedWidget\AdvancedStatsOverviewWidget as BaseWidget; with use Filament\Widgets\StatsOverviewWidget as BaseWidget;.

Differences to check when you move across:

  • Icon position: eightynine puts the icon at the end by default; here it is at the start, as in core. Add ->iconPosition('end') to keep the old layout.
  • progress() takes numbers only (progress($value, $max = 100)). Replace 'full' with 100 and 'empty' with 0.
  • chartColor() takes one colour, as in core. A second argument is ignored, and borderColor() / graphColor() don't exist here.
  • textColor() takes closures for the label and value only; the description colour is core's, which takes a colour name or palette array.
  • The cards look different, and this package only covers the stats widget, not eightynine's chart or table widgets. Check the result in the browser.

#Dark mode and colour

Every colour comes from your panel's palette, so cards follow your theme. In dark mode, colours appear as solid text, lines, bars and borders. The package never puts a translucent colour wash on a dark surface, where warm colours turn muddy. It also sets core's sparkline to a line without an area fill in dark mode, inside these cards only.

#Testing

composer test
composer analyse
scripts/ci-local.sh   # PHP 8.2-8.5 x Laravel 12-13 x Filament 4-5

#Changelog

See CHANGELOG.md.

#Support

  • 🐛 Bug or feature request: open an issue
  • 🔒 Security issue: please report it privately through GitHub's security tab

#Need this customised, or something built?

I'm available for custom development, package integration, and technical consulting.

Hire me on Upwork

#More packages

This is part of a family of open-source packages. See all of them.

filament-deleted-records A recycle bin for Filament: browse, restore or purge deleted models
filament-change-requests Hold record edits in Filament for approval, with a field-by-field diff
filament-url-image-uploader Upload images to Filament from a URL

#Credits

#License

The MIT License (MIT). See LICENSE.md.

The author

Muhammad Amjad avatar Author: Muhammad Amjad

I am a seasoned full-stack web developer specializing in Laravel, Livewire, and Vue.js ecosystems. With extensive experience in building modern web applications, I leverage the power of Laravel's elegant syntax and robust features to create scalable backend solutions. My expertise extends to crafting responsive and interactive user interfaces using Livewire and Vue.js, enhanced by the utility-first approach of Tailwind CSS.

Plugins
12
Stars
42

From the same author

Record Settings plugin thumbnail

Record Settings

Edit per-user, per-team and per-tenant settings in Filament from a settings page, a modal action or resource form fields, stored with glorand/laravel-model-settings or in a JSON column.

Muhammad Amjad avatar Author: Muhammad Amjad
92 / 100 package health score out of 100
2 stars
Recently added: New Tag: Panels More tags: +2
Dark mode ready No multilingual support
Free
Get it now
Uptime Monitor plugin thumbnail

Uptime Monitor

An admin UI for spatie/laravel-uptime-monitor that lets you add, edit, turn on and off and check uptime and SSL certificate monitors from your Filament panel, with status filters and a dashboard widget.

Muhammad Amjad avatar Author: Muhammad Amjad
92 / 100 package health score out of 100
1 star
Recently added: New Tag: Panels More tags: +2
Dark mode ready No multilingual support
Free
Get it now
XLSX Import plugin thumbnail

XLSX Import

Lets Filament's own ImportAction read Excel (.xlsx) and OpenDocument (.ods) workbooks as well as CSV, with a sheet picker, while your existing Importer classes, queued jobs and failed-rows downloads keep working unchanged.

Muhammad Amjad avatar Author: Muhammad Amjad
92 / 100 package health score out of 100
2 stars
Recently added: New Tag: Action More tags: +1
Dark mode ready No multilingual support
Free
Get it now
Billing Console plugin thumbnail

Billing Console

A free, read-only billing console for Laravel Cashier (Stripe) that shows your customers, subscriptions, invoices and payments, with an MRR and churn summary, "Open in Stripe" links and a safe "Sync from Stripe" action, inside your Filament panel.

Muhammad Amjad avatar Author: Muhammad Amjad
92 / 100 package health score out of 100
1 star
Recently added: New Tag: Panels More tags: +1
Dark mode ready No multilingual support
Free
Get it now