Character Counter by Tally Schmeits
CommunityA character counter for Text, Textarea and RichEditor fields
Author:
Tally Schmeits
Package health
Automated checks of this plugin's Composer package
15 checks
- Passed: 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
- Passed: Dependabot or Renovate configured
- Passed: Dependency update cooldown configured
- Passed: Provides a security policy
- Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
- Passed: Commit and release recency — Active: last commit 1 days ago; last release 117 days ago.
-
Passed:
composer.lock not committed by library
—
composer.lockis 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.2supports current PHP8.5. - Skipped: Current Symfony version supported
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
.
Documentation
- Compatibility
- Installation
- Usage
- Configuration
- Translations
- Upgrading to 5.2
- Testing
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
A character counter for the TextInput, Textarea and RichEditor fields of Filament 4 and 5.

#Compatibility
| Plugin version | Filament | Laravel | PHP |
|---|---|---|---|
| 1.x | 3.2 | 10, 11 | 8.1 or newer |
| 5.x | 4, 5 | 12, 13 | 8.2 or newer (8.3 for L13) |
#Installation
composer require schmeits/filament-character-counter:"^5.0"
For Filament 3.2, use version ^1.0.
The package ships a small stylesheet that is registered with Filament. After installing or updating, publish Filament's assets as usual:
php artisan filament:assets
#Usage
use Schmeits\FilamentCharacterCounter\Forms\Components\RichEditor;
use Schmeits\FilamentCharacterCounter\Forms\Components\Textarea;
use Schmeits\FilamentCharacterCounter\Forms\Components\TextInput;
TextInput::make('title')
->characterLimit(50),
Textarea::make('description')
->characterLimit(155),
RichEditor::make('content')
->characterLimit(155),
#Soft limit and hard limit
characterLimit()is a soft limit: it only drives the counter. The user can type past it; the counter then says how many characters are too many, for example "(12 too many)".maxLength()is a hard limit: the browser stops typing at that length and Laravel validates it. Without acharacterLimit(), the counter usesmaxLength().
// Counter shows 0 / 50, typing stops at 50.
TextInput::make('title')
->maxLength(50),
// Counter warns past 150, typing stops at 200.
TextInput::make('title')
->characterLimit(150)
->maxLength(200),
Both accept a closure. Without any limit the counter only shows the number of characters.
#Counter inside the field
TextInput and Textarea can show the counter inside the input:
TextInput::make('title')
->showInsideControl()
->characterLimit(50),
#Hiding the counter
use Filament\Schemas\Components\Utilities\Get;
// Never show the counter on this field
TextInput::make('slug')
->showCharacterCounter(false)
->characterLimit(100),
// Show it only when another field is on
Textarea::make('bio')
->showCharacterCounter(fn (Get $get): bool => (bool) $get('is_public'))
->characterLimit(255),
#How characters are counted
The counter counts per character (code point), the same way Laravel's max: rule does, so an emoji counts as one. It follows typing, pasting, autofill and changes made from PHP, such as $set() or resetting the form.
#Accessibility
Going over the limit is shown in words and in bold, not by colour alone, and is announced to screen readers. The input is linked to its counter with aria-describedby.
#Configuration
Publish the config file:
php artisan vendor:publish --tag="filament-character-counter-config"
return [
// Set to false to leave out the package stylesheet and style the counter yourself.
'load_css' => true,
];
The counter uses these CSS classes: fi-input-charcounter for the counter and fi-input-charcounter-exceeded when the limit is passed.
#Translations
Publish the translations:
php artisan vendor:publish --tag="filament-character-counter-translations"
return [
'character_separator' => ' / ',
'character_label' => 'characters',
'characters_over' => '(:count too many)',
];
#Upgrading to 5.2
- The RichEditor is no longer a copy of Filament's view. Filament renders the editor itself and the counter is placed around it, so features such as file attachments and mentions work again. If you published
rich-editor.blade.php, delete it and publish again. - The CSS class for an exceeded limit changed from
warningtofi-input-charcounter-exceeded. - The old translation key
character_seperatoris no longer read. Usecharacter_separator. getShowCharacterCounter()is deprecated in favour ofshouldShowCharacterCounter().
#Testing
composer test
composer analyse
#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
- Tally Schmeits
- Inspired by the package by Wiebe Nieuwenhuis
- All Contributors
#License
The MIT License (MIT). Please see License File for more information.
The author
Tally is an entrepreneur, husband, and father of three beautiful children! With his deep expertise in web development, particularly in Laravel and Filament, he has established and successfully runs his own company, Schmeits websolutions. He is committed to staying up-to-date with the latest technologies and tools, such as Filament, to deliver top-notch services to his clients.
From the same author
Phosphor Icon Pack
A Phosphor Icon Enum package to use the Phosphor icons everywhere in your Filament project.
Author:
Tally Schmeits
Umami Widgets
Display Umami Analytics data in your dashboard
Author:
Tally Schmeits
Pan Analytics Widget
Display PanPHP Analytics data in your dashboard
Author:
Tally Schmeits
Featured Plugins
A selection of plugins curated by the Filament team
Blueprint
Filament Blueprint is a premium Laravel Boost extension that helps AI agents produce accurate, detailed implementation plans and security reports for Filament apps.
Filament
Spotlight Pro
Browse your Filament Panel with ease. Filament Spotlight Pro adds a Spotlight like Command Palette to your Filament Panel.
Dennis Koch
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese