Skip to main content

Badgeable Column

v4.2.2
148
771,708

Display additional context as badges alongside your Filament table column values.

  • filament
  • filament-plugin
Badgeable Column thumbnail

Package health

Automated checks of this package

100 / 100
Security 100
Maintenance 100
Ecosystem 100
Powered by Plumb Last scanned 22 hours ago

Compatibility

Version Filament PHP Laravel Latest Docs
4.x (Current) ^4.0|^5.0 ^8.2 ^11.28|^12.0|^13.0 * v4.2.2 4.x docs
3.x ^4.0|^5.0 ^8.2 ^11.28|^12.0|^13.0 * v3.2.1 —
2.x ^3.0 ^8.1 ^10.45|^11.0|^12.0|^13.0 * v2.3.4 —
1.x ^2.0 ^8.0 ^9.0|^10.0 v1.2.4 —

* Taken from the Filament versions this release supports, using the newest release of each.

Badgeable Column adds badges to either side of a Filament text value. A product name can carry its stock status, a post title can carry its topics, an order reference can carry a "rush" flag — without giving each one a column of its own.

A Filament posts table whose Title column shows a grey category badge before each title and a green Published or amber Draft badge after it A Filament posts table whose Title column shows a grey category badge before each title and a green Published or amber Draft badge after it

use Awcodes\BadgeableColumn\Components\Badge;
use Awcodes\BadgeableColumn\Components\BadgeableColumn;

BadgeableColumn::make('title')
    ->suffixBadges([
        Badge::make('featured')->color('primary'),
    ])

Two components

The package ships two components, both of which behave exactly like the Filament component they extend:

Component Extends Use in
BadgeableColumn Filament\Tables\Columns\TextColumn Tables
BadgeableEntry Filament\Infolists\Components\TextEntry Infolists

Because they are subclasses, everything you already know applies — searchable(), sortable(), words(), copyable(), and the rest are all still available. The badges are additive.

Prefix and suffix

Badges attach on either side of the value. prefixBadges() puts them before it, suffixBadges() after, and a separator character sits between the badges and the text. Both accept a fixed array or a closure that builds one from the record.

See Usage for both, and Styling for badge shape, colour, size, and the separator.

Next steps

Start with Installation. The package ships Blade views that your Tailwind build needs to see, so there is one step beyond composer require.