Search by

gerenuk / filament-table-views

gerenuk

Saved table views and column-based advanced filters for Filament.

Package info

github.com/Gerenuk-LTD/filament-table-views

pkg:composer/gerenuk/filament-table-views

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-08 17:18 UTC

This package is auto-updated.

Last update: 2026-11-16 23:14:34 UTC


README

Project banner

Filament Table Views

Latest Version on Packagist GitHub Tests Action Status Total Downloads Licence

This package lets you save table views in your Filament panel, with filters that build themselves from your table's columns. Users save the current filters, sort, search and columns, share them, pin favourites above the table and come back to them from a link.

Table of Contents

  1. Introduction
  2. Version Compatibility
  3. Installation
  4. Usage
  5. Testing
  6. Changelog
  7. Contributing
  8. Security Vulnerabilities
  9. Credits
  10. License

Version Compatibility

Plugin Filament Laravel PHP
1.x 5.11+ 13.x 8.4|8.5

Installation

You can install the package via composer:

composer require gerenuk/filament-table-views

Views belong to the model of your default auth provider. Their user_id columns match that model's key, whether it uses integer IDs, UUIDs or ULIDs. If your panel signs in a different model, publish the config and set user_model before publishing and running the migration:

php artisan vendor:publish --tag="filament-table-views-config"
'user_model' => App\Models\Admin::class,

Publish the migration and run it. It creates the table_views and table_view_favorites tables. The published migration can be edited before you run it.

php artisan vendor:publish --tag="filament-table-views-migrations"
php artisan migrate

Publish the package's stylesheet. Filament's filament:upgrade script does this for you if it runs after composer update:

php artisan filament:assets

Optionally, you can publish the translations using

php artisan vendor:publish --tag="filament-table-views-translations"

Usage

Registering the Plugin

Add the plugin to your panel:

use Gerenuk\FilamentTableViews\FilamentTableViewsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(FilamentTableViewsPlugin::make());
}

Column Filters

Add ColumnQueryBuilder to a table's filters. It reads the table's columns and adds a rule for each column backed by the database:

use Gerenuk\FilamentTableViews\Filters\ColumnQueryBuilder;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            TextColumn::make('reference')->searchable()->sortable(),
            TextColumn::make('status.name')->label('Status'),
            TextColumn::make('total')->money('GBP'),
            IconColumn::make('is_paid')->boolean(),
            TextColumn::make('placed_at')->dateTime(),
        ])
        ->filters([
            ColumnQueryBuilder::make(),
        ]);
}

The type of each rule comes from the column and the database:

Column Rule
Toggle, checkbox, boolean icon, or a boolean cast or column type Boolean
date() or dateTime() text column, or a date column type Date
numeric() or money() text column, or a numeric column type Number
A column on a direct relationship, such as status.name "Is related to", a searchable select
Anything else Text

Deeper relationships, such as customer.company.name, filter on the related value. Image columns, and columns that aren't backed by the database (such as accessors), are skipped.

Leave columns out with excludeColumns(). Rules you add yourself with constraints() replace a generated rule of the same name:

ColumnQueryBuilder::make()
    ->excludeColumns(['internal_note'])
    ->constraints([
        TextConstraint::make('notes'),
    ]),

If the table hasn't chosen a filter layout, the filters open in a slide-over wide enough to keep each rule on one line. Any layout or width the table sets itself is kept.

Saved Views

Add the HasTableViews trait to a resource's list page:

use Filament\Resources\Pages\ListRecords;
use Gerenuk\FilamentTableViews\Concerns\HasTableViews;

class ListOrders extends ListRecords
{
    use HasTableViews;

    protected static string $resource = OrderResource::class;
}

This adds a bar above the table:

  • Save view saves the current filters, sort, search and columns, with a name, icon and colour. Users can share a view with everyone and add it to their favourites.
  • Favourites show as tabs next to Default view. Users drag the tabs to reorder them.
  • Update view appears when the open view is yours and the table has changed since it was saved. A dot on the tab shows the same thing.
  • Views opens a slide-over to search, apply, favourite, edit and delete views. Only the owner of a view can edit or delete it.

Views are stored per resource, so renaming the list page keeps them.

Colours show as a row of circles, and every outline and solid Heroicon is offered (searchable). Choose your own with colors() and icons():

FilamentTableViewsPlugin::make()
    ->colors(['success', 'info', 'warning', 'danger', 'gray'])
    ->icons([Heroicon::OutlinedStar, Heroicon::OutlinedFlag]),

colors() takes Filament colour names. The default is grey, primary, blue, green, amber and red. Leave icons() out to offer every Heroicon.

Favourites for Everyone

A favourite for everyone is pinned to every user's bar, before their own favourites. Choose who can set one with globalFavorites():

FilamentTableViewsPlugin::make()
    ->globalFavorites(fn (User $user): bool => $user->isAdmin()),

Those users get a "Favourite for everyone" toggle when saving or editing their own views. A favourite for everyone is always shared.

User Views Page

The User Views page is off by default. Turn it on and choose who can open it:

FilamentTableViewsPlugin::make()
    ->userViews(fn (User $user): bool => $user->isAdmin())
    ->userViewsNavigationGroup('Settings'), // optional

The page:

  • lists every saved view in the current tenant, whoever owns it;
  • lets those users rename, recolour, share or unshare, and delete any view, and set favourites for everyone (when they also pass globalFavorites());
  • lets them drag favourites for everyone into order on the "Favourites for everyone" tab.

Only the users that userViews() allows can open the page or use its actions.

Placing the Views Bar

The trait adds the bar through the page's content() method. If your page overrides content(), add the bar yourself:

public function content(Schema $schema): Schema
{
    return $schema
        ->components([
            $this->getTabsContentComponent(),
            $this->getTableViewsComponent(),
            EmbeddedTable::make(),
        ]);
}

How Views Behave

  • Links: the open view is kept in the URL as ?view=, so a reload keeps it open. A link with only ?view= applies the whole view.
  • Changed tables: if a column, filter or rule type has been removed since a view was saved, that part of the view is dropped and the rest still loads.
  • Visibility: users see their own views and views shared with everyone. In a panel with tenancy, views, including shared views and favourites for everyone, belong to the tenant they were saved in.

Testing

composer test
composer analyse
composer format

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.