Search by

coolsam / filament-grid

coolsam726

An Odoo-style list grid for Filament: dense rows, inline row editing, optional columns, drag-handle reordering, grouping and editable one-to-many grids in forms.

Package info

github.com/coolsam726/filament-grid

pkg:composer/coolsam/filament-grid

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.0.0 2026-12-03 10:27 UTC

This package is auto-updated.

Last update: 2026-12-04 07:35:57 UTC


README

An Odoo-style list grid for Filament v4 and v5. A list page renders this grid instead of a table. The same columns drive an editable GridField and a read-only GridEntry.

Packagist Version Packagist Downloads PHP Version Filament Version License: MIT Plumb score

Filament Grid

Requirements

PHP >=8.2 <8.6 and filament/filament ^4.0 or ^5.0, from this package's composer.json.

This package does not constrain Laravel or Livewire. Install the Laravel and Livewire versions your Filament release requires. Current Filament 4.x (filament/support 4.x) requires illuminate/contracts ^11.28, ^12.0, or ^13.0, and Livewire ^3.8.12. Current Filament 5.x (filament/support 5.12) requires the same Laravel constraint and Livewire ^4.4.9.

Composer discovers the service provider. There is no panel plugin to register.

Installation

composer require coolsam/filament-grid
php artisan filament-grid:install

filament-grid:install is the install step. It runs php artisan filament:assets, publishes the config and the preferences migration, writes FILAMENT_GRID_PREFERENCES to .env when that key is absent (local by default), and runs migrations. --force overwrites published config and migration files. --no-migrate skips migrations. --preferences=local or --preferences=database sets the driver in .env. An existing FILAMENT_GRID_PREFERENCES line is left unchanged when --preferences is omitted.

filament:assets publishes the Alpine component and stylesheet registered by FilamentGridServiceProvider (coolsam/filament-grid). The grid loads that CSS when it renders. Run php artisan filament-grid:install again after you upgrade the package.

Column preferences default to the browser (localStorage). To store them in the database, install with the database driver:

php artisan filament-grid:install --preferences=database

That publishes the config and migration, migrates, and sets the env key. The same publish and migrate steps on their own are:

php artisan vendor:publish --tag=filament-grid-config
php artisan vendor:publish --tag=filament-grid-migrations
php artisan migrate

In .env:

FILAMENT_GRID_PREFERENCES=database

local is the default and matches the config file shipped with the package.

database writes one row per user per grid in filament_grid_preferences (or the table set as preferences.table). The signed-in user is the owner.

A grid can override the driver with ->preferencesDriver('local') or ->preferencesDriver('database').

For local development of this repository, add a path repository in the app and require the dev version. That is not the normal install:

"repositories": [
    { "type": "path", "url": "../filament-grid" }
]
composer require coolsam/filament-grid:@dev

List page

HasGridListing replaces the table on the resource list page. Define the grid as OrderResource::grid(). A grid() method on the page is used on its own; call the resource method when the page should start from it.

Replacing the table

The list page renders the grid in the page body and applies the resource query, create permission, create URL, edit and delete permissions, and record URL before your configuration runs.

use Coolsam\FilamentGrid\Concerns\HasGridListing;
use Filament\Resources\Pages\ListRecords;

class ListOrders extends ListRecords
{
    use HasGridListing;
}

Orders list grid

Page size

The size menu defaults to 10, 15, and 20. The user's choice is remembered when it is still one of the offered sizes. Field grids and infolist entries do not page. An empty perPageOptions() hides the menu.

public function grid(Grid $grid): Grid
{
    return OrderResource::grid($grid)->perPage(10)->perPageOptions([10, 15, 20]);
}

Page size

Search

Type a term, then pick one searchable column. The next term replaces that facet.

TextColumn::make('number')->searchable(),
BelongsToColumn::make('customer')->searchable(),
BadgeColumn::make('status')->searchable(),

Search one column

Filters

Filters in the same group() are OR. Filters in different groups are AND. default() selects a filter initially.

use Coolsam\FilamentGrid\Filters\Filter;
use Illuminate\Database\Eloquent\Builder;

Filter::make('urgent')->query(fn (Builder $query) => $query->where('is_urgent', true)),
Filter::make('pending')->group('status')->query(fn (Builder $query) => $query->where('status', 'pending')),
Filter::make('processing')->group('status')->query(fn (Builder $query) => $query->where('status', 'processing')),

Urgent filter

Grouping

groupable() columns appear under Group by. defaultGroup('status') opens on that column. A date column that includes a calendar date can group by year, month, or day.

BadgeColumn::make('status')
    ->options([
        'pending' => 'Pending',
        'processing' => 'Processing',
        'shipped' => 'Shipped',
        'completed' => 'Completed',
        'cancelled' => 'Cancelled',
    ])
    ->groupable(),

Grouped by status

Sorting

sortable() sends the sort to the server. defaultSort('total') sets the initial column. Drag-handle reordering works while the list is sorted by its sequence column.

MoneyColumn::make('total')->currency('USD')->sortable()->sum(),

Total sorted ascending

Record actions

url() is a link. action() runs on the server for that record. Omitting recordActions() lets the list page add View, Edit, and Delete when the policy allows them. Passing recordActions() replaces that list, including an empty array.

use Coolsam\FilamentGrid\Actions\RecordAction;

->recordActions([
    RecordAction::make('view')->label('View')->icon('heroicon-o-eye')
        ->url(fn (Order $record): string => OrderResource::getUrl('view', ['record' => $record])),
    RecordAction::make('edit')->label('Edit')->icon('heroicon-o-pencil-square')
        ->url(fn (Order $record): string => OrderResource::getUrl('edit', ['record' => $record])),
])

View and Edit

Cards

cards() renders each record as a card at viewports up to 640px. Wider screens keep the table. cardTitle('number') picks the heading. Otherwise the first visible text, badge, or belongs-to column is used.

return $grid->cards()->cardTitle('number');

Order cards

Bulk actions

The Actions menu runs BulkActions against the selection. BulkAction::delete() deletes the selected records the user is allowed to delete. A custom action receives the selected $records.

use Coolsam\FilamentGrid\Actions\BulkAction;

->bulkActions([
    BulkAction::delete(),
])

Bulk delete

Column order

Columns start in the order you pass them. Drag a header to move one. The handle, the checkbox, and the trailing action column stay put, and the new order is remembered.

->columns([
    TextColumn::make('number'),
    BelongsToColumn::make('customer'),
    BadgeColumn::make('status')->options([
        'pending' => 'Pending',
        'shipped' => 'Shipped',
        'completed' => 'Completed',
    ]),
])

Dragging a column

Reordering rows

reorderable('sort') shows a drag handle and stores the order in that integer column. The column name defaults to sort. Dragging is available while the list is sorted by sequence.

return $grid->reorderable('sort');

Row drag handles

New opens the create page

editable(false) keeps the list read-only. New still shows, and HasGridListing points it at the resource create page when canCreate() passes. creatable(false) hides New. A header CreateAction on the page is a separate button.

return $grid->editable(false);

New

Inline editing

editable() inserts a row when you press New. New rows land at the bottom. Pass NewRowPosition::Top to editable(), or call newRowPosition(), to add them at the top. The cloud button commits the row.

use Coolsam\FilamentGrid\Enums\NewRowPosition;

return $grid->editable(); // or ->editable(NewRowPosition::Top)

New row on the list

Multi-edit

Multi-edit is on when the grid is editable and selectable. Editing a cell with several rows selected asks before writing that column on each selected record. Nothing is saved until you confirm. multiEdit(false) turns it off.

return $grid->editable()->multiEdit();

Confirm a multi-edit

Optional columns

optional() adds the column to the optional-columns menu. optional(hidden: true) starts hidden. The choice is remembered with the column order and widths.

PriorityColumn::make('priority')->optional(),
BooleanColumn::make('is_urgent')->label('Urgent')->toggle()->optional(),
DateColumn::make('created_at')->time()->optional(hidden: true),

Optional columns

Form

GridField edits a has-many, has-one, or belongs-to-many relationship inside a form. Lines stay in the form state and are written when the parent form is saved. The field name is the relationship name when you call relationship() with no arguments.

Placing a grid

Put the field on the order form and point it at lines. Any other relationship type throws. The columns are the same classes the list page uses.

use Coolsam\FilamentGrid\Forms\GridField;

GridField::make('lines')
    ->label('Order lines')
    ->relationship()
    ->reorderable('sort')
    ->gridColumns(OrderForm::lineColumns());

Order lines on the form

Adding a line

Add a line is shown unless you call addable(false). minimumRows() pads the empty area. The default is 3. A new line uses each column's default(), here quantity 1 and unit price 0.

GridField::make('lines')->relationship()->addable()->minimumRows(3);

Empty new line

Deleting a line

deletable() is on unless you pass false. The trash button removes the line from the form. The relationship row is deleted when the parent form is saved.

GridField::make('lines')->relationship()->deletable();

Delete a line

Grouping

A groupable() column groups the loaded lines in the browser. Product is groupable on the order form, so each line sits under its product.

BelongsToColumn::make('product')->groupable(),

Lines grouped by product

Predefined filters

filters() takes the same Filter list as a page grid. The field has no fetch endpoint, so each loaded row is tagged with the filters it matches and the browser applies them. Toggling a filter commits the row that is mid-edit first. A new unsaved line stays visible. An editable field shows the search toolbar when it has filters.

use Coolsam\FilamentGrid\Filters\Filter;
use Illuminate\Database\Eloquent\Builder;

->filters([
    Filter::make('qty_at_least_2')
        ->label('Qty 2+')
        ->query(fn (Builder $query) => $query->where('quantity', '>=', 2)),
])

Quantity filter

Reordering rows

reorderable('sort') shows the handle. Dragging updates the form state. The integer is stored when the form is saved, on the related model for a has-many and on the pivot for a belongs-to-many.

GridField::make('lines')->relationship()->reorderable('sort');

Line drag handles

Autosave

Autosave is off until you call autosave(). The open row keeps the cloud button and the discard mark, and that button commits the line into the form state only. autosave() waits 800ms, or pass a delay such as autosave(1500). The parent record stays unsaved. On a list, the same call writes the record and does not submit a surrounding form. It runs only while the grid is editable.

GridField::make('lines')->relationship(); // call ->autosave() to commit after a pause

Commit a line by hand

Saving the parent

Ctrl+S or Cmd+S saves the line you are editing and submits the parent form, the same submit as Save. The lines are written to the relationship at that point.

GridField::make('lines')->relationship()->gridColumns([
    TextColumn::make('description')->required(),
]);

Parent form saved

Notebook

Notebook::make() takes Tab pages. The strip uses the same underline tabs as a grid that sits on its own. A GridField inside a tab does not render a second strip. notebook(false) removes that one-tab wrapper. Arrow keys, Home, and End move between tabs while focus is on the strip.

use Coolsam\FilamentGrid\Schemas\Notebook;
use Coolsam\FilamentGrid\Schemas\Notebook\Tab;
use Filament\Forms\Components\DateTimePicker;

Notebook::make([
    Tab::make('Order lines')->schema([
        GridField::make('lines')->relationship()->gridColumns(OrderForm::lineColumns()),
    ]),
    Tab::make('Schedule')->schema([
        DateTimePicker::make('ordered_at'),
    ]),
]);

Schedule tab

Belongs to many

relationship() accepts a belongs-to-many. Removing a line detaches it and leaves the related record in the database. reorderable() stores the position on the pivot, and other pivot columns that match a grid column are filled from the row. The Orders demo has no belongs-to-many, so this subsection has no screenshot.

GridField::make('products')
    ->relationship()
    ->reorderable()
    ->gridColumns([
        TextColumn::make('name'),
    ]);

Validation

required() and rules() run when the row commits. An empty required cell is marked invalid and the row stays open.

TextColumn::make('description')->required(),

Invalid description

Columns

Every column supports label(), alignment() (start, end, center), sortable(), searchable(), groupable(), readOnly(), required(), rules(), default(), placeholder(), tooltip(), formatStateUsing(), and hidden() / visible(). sum() and avg() add a footer aggregate.

Text

TextColumn is the plain text cell. maxLength() and email() constrain it. mask() is covered on its own below.

TextColumn::make('number')->required()->searchable()->sortable(),

Order number

Number

NumberColumn is right-aligned. decimals() sets the fraction digits. integer() drops them. minValue() and maxValue() bound the editor.

NumberColumn::make('quantity')->decimals(2)->default(1)->minValue(0),

Quantity

Money

MoneyColumn is a number column that formats a currency. locale() overrides the app locale. decimals() defaults to 2. sum() totals the footer.

MoneyColumn::make('total')->currency('USD')->sortable()->sum(),

Money totals

Select

SelectColumn shows the option label as plain text. Options are an array of value to label, a backed enum class, or a closure. Search matches the labels.

use Coolsam\FilamentGrid\Columns\SelectColumn;

SelectColumn::make('status')->options([
    'pending' => 'Pending',
    'shipped' => 'Shipped',
    'completed' => 'Completed',
])->default('pending'),

Plain status labels

Badge

BadgeColumn is a select that renders a badge. Colors are Filament color names (primary, success, warning, danger, info, gray). A backed enum used as options() can implement Filament's HasColor. The editor is still the select.

use Coolsam\FilamentGrid\Columns\BadgeColumn;

BadgeColumn::make('status')
    ->options([
        'pending' => 'Pending',
        'shipped' => 'Shipped',
        'completed' => 'Completed',
        'cancelled' => 'Cancelled',
    ])
    ->colors([
        'pending' => 'warning',
        'shipped' => 'primary',
        'completed' => 'success',
        'cancelled' => 'danger',
    ]),

Status badges

Toggle

toggle() draws the grid's own switch. On an editable list, clicking the switch saves that record immediately.

BooleanColumn::make('is_urgent')->label('Urgent')->toggle(),

Urgent switch

Checkbox

Leave toggle() off and the boolean cell is a checkbox. The editor is that same checkbox.

BooleanColumn::make('is_urgent')->label('Urgent'),

Urgent checkboxes

Date and time

time() shows a date and a time. date() and dateTime() pick the other shapes, and a string argument is the display format. since() uses diffForHumans(). timezone() sets the picker and the display. native(true) is the browser control and is the default. native(false) uses the grid calendar, with displayFormat(), minDate(), and maxDate().

DateColumn::make('ordered_at')->time()->sortable()->groupable(),

Ordered at

Priority

PriorityColumn draws stars. stars(3) is the default. Click a star to set it, and click the current star to clear it. On an editable list that click saves immediately.

PriorityColumn::make('priority')->stars(3),

Priority stars

Progress

ProgressColumn is a read-only bar. There is no editor. max() is the value that fills the bar, and the label is the cell value as a percent of that. getStateUsing() can supply the number. It is display-only.

use Coolsam\FilamentGrid\Columns\ProgressColumn;

ProgressColumn::make('fill')
    ->label('Fill')
    ->max(3)
    ->getStateUsing(fn (Order $record): int => (int) $record->priority),

Progress bar

Belongs to

The column name is the relationship. The cell shows titleAttribute() (default name) and edits it with an autocomplete. searchColumns() and modifyRelatedQueryUsing() narrow the query. quickCreate() offers Create "term", or pass a closure that receives the search and returns the new model.

BelongsToColumn::make('customer')->searchable()->sortable()->groupable()->quickCreate(),

Customer names

Tags

TagsColumn shows chips. json() stores the strings on the attribute. A column cast to array, json, or collection, which is not a relationship, is stored that way without calling json(). Without json(), a belongs-to-many is synced in afterSave(). Tags are never sortable or groupable. The picture is the JSON chips. The Orders demo has no belongs-to-many tags, so that sync has no screenshot.

use Coolsam\FilamentGrid\Columns\TagsColumn;

TagsColumn::make('labels')->json(),

JSON tag chips

Calculated value

getStateUsing() replaces the stored attribute for display and marks the column read-only. sum() still totals the footer.

MoneyColumn::make('subtotal')
    ->currency('USD')
    ->getStateUsing(fn (OrderLine $record): float => (float) $record->quantity * (float) $record->unit_price)
    ->sum(),

Line subtotals

Pinned columns

pin() sticks the column to the left, after the handle and checkbox. pin('right') sticks it before the trailing actions. Several left pins stack in column order. Cards ignore pins. If the pinned columns would leave less than 120px to scroll, the extra pins stay in normal flow.

TextColumn::make('number')->pin(),

Number stays pinned

Prefix and suffix

prefix() and suffix() accept a string or a closure. They are shown in the cell and in the text editor.

TextColumn::make('description')->prefix('Note:'),
NumberColumn::make('quantity')->decimals(2)->suffix(' pcs'),

Prefix and suffix

Link

url() makes the displayed text a link. A string is the href. true or a closure uses the state when it looks like http://, https://, //, or mailto:. Clicking the link follows it and does not start an edit.

TextColumn::make('number')->url(
    fn (Order $record): string => OrderResource::getUrl('view', ['record' => $record])
),

Linked order numbers

Copyable

copyable() adds a copy control that writes the state text to the clipboard. The click does not start an edit.

TextColumn::make('number')->copyable(),

Copyable order numbers

Mask

mask() is applied while typing. 9 is a digit, a is a letter, * is any character, and any other character is a literal.

TextColumn::make('number')->mask('aaa-999'),

Masked text

Width

width() sets the starting width in pixels. Drag the header edge to resize. The width is remembered. The card layout does not offer resize.

BelongsToColumn::make('customer')->width(320),

A wider customer column

Hidden on cards

cardHidden() leaves the column out of the card body. The table still shows it.

BelongsToColumn::make('customer')->cardHidden(),

Card without the customer

Input types

These are the editors a cell opens. Money uses the number editor. Progress has no editor.

Text input

A text column opens a single-line input. The orange underline is the cell being edited.

TextColumn::make('description')->required()->searchable(),

Description input

Number input

A number column, and a money column, open this input. The money format is applied again when the cell closes.

NumberColumn::make('quantity')->decimals(2)->minValue(0),

Quantity input

Select input

A select column, and a badge column while editing, open the browser's select. The closed control shows the current label.

SelectColumn::make('status')->options([
    'pending' => 'Pending',
    'processing' => 'Processing',
    'shipped' => 'Shipped',
    'completed' => 'Completed',
    'cancelled' => 'Cancelled',
]),

Status select

Toggle input

With toggle(), the switch is the editor. On an editable list, clicking it saves immediately.

BooleanColumn::make('is_urgent')->label('Urgent')->toggle(),

Urgent switch in the row

Checkbox input

A boolean column opens a checkbox. The ring shows the cell that has focus.

BooleanColumn::make('is_urgent')->label('Urgent'),

Checkbox editor

Date picker

native(false) opens the grid calendar. displayFormat() is the text in the cell. minDate() and maxDate() bound the value. closeOnDateSelection() closes the popup after a day is chosen.

DateColumn::make('created_at')
    ->label('Added')
    ->native(false)
    ->displayFormat('M j, Y')
    ->minDate('2026-12-02')
    ->maxDate('2026-12-25')
    ->closeOnDateSelection(),

Calendar popup

Native date and time

native(true) is the default, so time() uses the browser's date-and-time control.

DateColumn::make('ordered_at')->time(),

Browser date and time control

Tags input

The tags editor shows the chips and a field. On a json() column, Create "term" adds a chip in the browser. A relationship column uses quickCreate() instead, and that path is not in the Orders demo.

TagsColumn::make('labels')->json(),

Tag editor

Relation search

A belongs-to column opens an autocomplete. The menu lists relation_search_limit matches (default 8) before Search more. quickCreate() adds Create "term".

BelongsToColumn::make('product')->required()->quickCreate(),

Product search

Priority input

The open row shows the stars you click. On an editable list, clicking a star saves immediately.

PriorityColumn::make('priority')->stars(3),

Stars while editing

Entry types

GridEntry is the read-only infolist. It uses the same columns, loads every related record, and does not page. It has no editors, no Add a line, no delete, and no record actions. It stays a table unless you call cards().

Read-only lines

Name the entry after the relationship, or call relationship(). Search, filters, grouping, and sorting then run in the browser on the rows already loaded.

use Coolsam\FilamentGrid\Infolists\GridEntry;

GridEntry::make('lines')
    ->label('Order lines')
    ->filters(OrderForm::lineFilters())
    ->gridColumns(OrderForm::lineColumns());

Read-only lines

Search

A searchable() column, a groupable() column, or a filter list shows the search toolbar. Search uses one column at a time.

TextColumn::make('description')->searchable(),

Search line descriptions

Filters

filters() is the same predefined list as on a page grid and on GridField. Each loaded row is tagged with the filters it matches.

GridEntry::make('lines')->filters([
    Filter::make('qty_at_least_2')
        ->label('Qty 2+')
        ->query(fn (Builder $query) => $query->where('quantity', '>=', 2)),
]);

Filtered lines

Grouping

groupable() columns appear under Group by. The groups are built from the loaded lines.

BelongsToColumn::make('product')->groupable(),

Lines grouped on the view page

Sorting

Click a sortable() header to reorder the loaded lines. That reorder is applied together with a search, a filter, or a group. Here quantity is descending after a description search, so the lines read 4.00, 2.00, then 1.00.

NumberColumn::make('quantity')->decimals(2)->sortable(),

Quantity sorted descending

Notebook

The entry uses the same notebook as the form. Inside a tab it does not render a second strip. On the view page the Schedule tab is plain text.

use Filament\Infolists\Components\TextEntry;

Notebook::make([
    Tab::make('Order lines')->schema([
        GridEntry::make('lines')->gridColumns(OrderForm::lineColumns()),
    ]),
    Tab::make('Schedule')->schema([
        TextEntry::make('ordered_at')->dateTime(),
    ]),
]);

Schedule on the view page

Developing

composer test runs Pest, composer analyse runs PHPStan, and composer format runs Pint. bin/dev-publish.sh rebuilds resources/dist and runs filament:assets plus view:clear in ../filament-chrome-demo, or in the path you pass as the first argument. After you change this package's JS or CSS in a path repository, run php artisan filament:assets in the app so Filament copies the built files again. Browser checks live in tests/Browser and need a Filament app to open.

License

MIT.