Collapsible Column Group
CommunityCollapsible (expand/collapse) column groups for FilamentPHP tables — v3, v4, and v5. Click a group header and the columns it spans fold away into a thin placeholder; click again to bring them back.
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:
PtPlugins
Documentation
Collapsible (expand/collapse) column groups for FilamentPHP tables — v3, v4, and v5. Click a group header and the columns it spans fold away into a thin placeholder; click again to bring them back.
Wide tables with logically grouped columns (e.g. Q1 / Q2 / Q3 / Q4, or Address, Contact, Billing) get unreadable fast. This package turns any Filament ColumnGroup header into a toggle that collapses everything under it, so users can focus on the groups they care about. The collapsed state is remembered and survives sorting, filtering and pagination.
Single codebase across all three Filament major versions — same class, same API.
#Installation
composer require ptplugins/filament-collapsible-column-group
The package auto-discovers its service provider and registers its own JS/CSS through FilamentAsset. There is nothing to publish.
#Quick start
Swap Filament's ColumnGroup for CollapsibleColumnGroup and call ->collapsible():
use PtPlugins\FilamentCollapsibleColumnGroup\CollapsibleColumnGroup;
use Filament\Tables\Columns\TextColumn;
public function table(Table $table): Table
{
return $table->columns([
TextColumn::make('name'),
CollapsibleColumnGroup::make('Q1')
->collapsible()
->columns([
TextColumn::make('jan'),
TextColumn::make('feb'),
TextColumn::make('mar'),
]),
CollapsibleColumnGroup::make('Q2')
->collapsible(collapsedByDefault: true) // starts folded
->columns([
TextColumn::make('apr'),
TextColumn::make('may'),
TextColumn::make('jun'),
]),
]);
}
That's it. Each collapsible group header shows a − (expanded) or + (collapsed) icon; clicking it folds the columns it spans into a single thin placeholder cell so the row layout stays intact.
#API
| Method | Default | Description |
|---|---|---|
collapsible(bool $collapsible = true, bool $collapsedByDefault = false) |
— | Makes the group header a collapse/expand toggle. Pass collapsedByDefault: true to render it folded on first load. |
CollapsibleColumnGroup extends Filament's ColumnGroup, so everything you already do with a column group keeps working — ->columns([...]), ->alignment(), ->wrapHeader(), and so on. collapsible() is purely additive; a group without it behaves exactly like a normal ColumnGroup.
#How it works
The PHP class is a thin annotator. When a group is collapsible() it:
- prepends a
+/−icon to the group label, and - tags the group header
<th>withdata-collapsible-groupanddata-collapsed-defaultviaextraHeaderAttributes().
All behaviour lives in the bundled JS:
- A single delegated click handler toggles the group: it shrinks the header's
colspan, hides the body cells the group spans (keeping the first one as a2remplaceholder so columns stay aligned), and flips the icon. - The collapsed/expanded state is stored per group in
sessionStorageand re-applied on a Livewirecommithook, so it persists across sorting, filtering, pagination and any other Livewire re-render.
Because it only touches the public ColumnGroup API plus its own data-* hooks — never Filament's internal markup or CSS classes — the exact same code runs on Filament v3, v4 and v5 (Livewire 3 and 4).
#Notes & gotchas
- Group state keys off the label. Persistence uses a slug of the group label, so give collapsible groups in the same table distinct labels (two groups both labelled "Total" would share one collapsed state).
- Toggling is pure front-end. Collapsing never hits the server — it's instant and does not re-query. Only the persisted state is re-applied after Livewire updates.
- It folds columns, not data. Collapsed columns are hidden in the DOM, not removed from the query. Exports, summaries and totals are unaffected.
#Requirements
- PHP 8.1+
- Filament 3.x, 4.x, or 5.x
#License
MIT — see LICENSE.md.
Part of the ptplugins.com collection of FilamentPHP plugins.
The author
From the same author
Pikaday
Pikaday date picker field for FilamentPHP — lightweight, dependency-light date input with min/max dates, year range, first-day-of-week, and full i18n.
Author:
PtPlugins
Number Input
A locale-aware numeric input field for FilamentPHP v3, v4, and v5. The user types and sees a localized number (European 12.345,67 or US 12,345.67); your model always stores a clean float (12345.67).
Author:
PtPlugins
Pivot Table Free
Free pivot table Blade component for FilamentPHP. Group Eloquent records into a 2-dimensional pivot with Sum aggregation. Works with Filament 3, 4, and 5.
Author:
PtPlugins
Auto Filters
Automatic table filters for FilamentPHP v3, v4, and v5 based on your column definitions. Stop writing repetitive filter code — just define your columns and get smart filters for free.
Author:
PtPlugins
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
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
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