Count Up
CommunityAnimates numbers in stat widgets, custom widgets, and table columns so they count up from zero instead of just appearing.
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
.
Author:
Ahmed Abdelrahim
Documentation
Animate any number in your Filament app — dashboard stats, custom widget cards, table columns — so it counts up from zero instead of just appearing. No countup.js dependency, no build step in your app: it's a small self-contained Alpine.js component shipped and registered by this package.
- Works in genuine
Stat::make()widgets, fully custom Blade widgets, andTables\Columns\CountUpColumn. - Preserves whatever thousands/decimal separators your app already uses (plain
,/.by default — not locale-awareIntl.NumberFormat, so it never flips to Arabic-Indic digits on anarlocale). - Renders the final, correctly formatted number as static text first, so it's correct even with JavaScript disabled or before Alpine hydrates — the animation is a progressive enhancement, not a requirement for correctness.
- Respects
prefers-reduced-motion: reduceby skipping straight to the final value.
#Installation
You can install the package via composer:
composer require xplodman/filament-count-up
You can publish the config file with:
php artisan vendor:publish --tag="filament-count-up-config"
This is the contents of the published config file:
return [
// Used whenever a component/column does not explicitly set its own value.
'decimals' => 0,
'duration' => 1000,
'thousands_separator' => ',',
'decimal_separator' => '.',
];
#Usage
#In a Blade view or custom widget
<x-count-up :value="1234.5" :decimals="2" prefix="EGP " />
This is what powers a fully custom stats card, e.g. a widget view iterating over an array of cards:
<p class="mt-2 text-3xl font-semibold">
<x-count-up :value="$card['value']" :decimals="0" />
</p>
#In a genuine Stat::make() widget
CountUpStat::make() returns a Htmlable view, so it can be passed straight in as the stat's value:
use Filament\Widgets\StatsOverviewWidget\Stat;
use Xplodman\CountUp\Facades\CountUpStat;
Stat::make('Total sales', CountUpStat::make($totalSales, decimals: 2, prefix: 'EGP '));
#In a table column
use Xplodman\CountUp\Tables\Columns\CountUpColumn;
CountUpColumn::make('current_balance')
->countUpDecimals(2)
->countUpPrefix('EGP ')
->countUpDuration(750);
CountUpColumn extends the regular TextColumn, so getStateUsing(), sorting, searching, and everything else you'd expect from a text column keeps working — the raw state is simply rendered through the animated component instead of a plain string.
Available fluent methods on CountUpColumn (all accept a Closure, evaluated against the column/record):
| Method | Default |
|---|---|
countUpDecimals(int) |
count-up.decimals |
countUpDuration(int) |
count-up.duration |
countUpThousandsSeparator() |
count-up.thousands_separator |
countUpDecimalSeparator() |
count-up.decimal_separator |
countUpPrefix(string) |
'' |
countUpSuffix(string) |
'' |
#Testing
composer test
#Changelog
Please see CHANGELOG for more information on what has changed recently.
#Contributing
Please see CONTRIBUTING for details.
#Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
#Credits
#License
The MIT License (MIT). Please see License File for more information.
The author
Hey, I'm Ahmed — a Laravel/PHP dev based in Cairo, currently building telecom stuff at Mobiadd. Been doing this for 8+ years, from WordPress plugins with a million+ installs to Filament dashboards handling real traffic. Still enjoy tinkering with the little details most people skip.
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Custom Fields
Eliminate custom field migrations forever. Let your users create and manage form fields directly in Filament admin panels with 20+ built-in field types, validation, and zero database changes.
Relaticle
Spotlight Pro
Browse your Filament Panel with ease. Filament Spotlight Pro adds a Spotlight/Raycast like Command Palette to your Filament Panel.
Dennis Koch