ilobegashvili / filament-comparison-table
An editable, per-locale, multi-column comparison table Livewire component for Filament forms.
Package info
github.com/ilo-begashvili/filament-comparison-table
Language:Blade
pkg:composer/ilobegashvili/filament-comparison-table
Requires
- php: ^8.2
- filament/filament: ^4.0
- illuminate/console: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- livewire/livewire: ^3.0
This package is not auto-updated.
Last update: 2026-08-14 04:55:36 UTC
README
An editable, per-locale, multi-column comparison table Livewire component for Filament v4 forms — no fixed columns, add and name whatever you need (specs, plans, feature grids), plus optional full-width section header rows.
Requirements
- PHP 8.2+
- Laravel 11/12/13
- Filament 4.x
- Livewire 3.x
Installation
composer require ilobegashvili/filament-comparison-table php artisan comparison-table:install
The install command asks which locales you want (comma-separated, e.g. en,ka,de) and publishes config/comparison-table.php pre-filled with your answer. Just press enter to default to en only.
You can re-run php artisan comparison-table:install any time, or edit config/comparison-table.php directly:
return [ 'locales' => ['en', 'ka'], 'primary_color' => '#2563eb', ];
Publish the Blade view (optional)
If you want to restyle the table beyond primary_color, publish the view and edit it directly:
php artisan vendor:publish --tag=comparison-table-views
Setup
Add an array-cast column to the model that owns the table:
Schema::table('products', function (Blueprint $table) { $table->json('comparison_table')->nullable(); });
protected function casts(): array { return [ 'comparison_table' => 'array', ]; }
Usage in a Filament Schema
use Filament\Schemas\Components\Livewire; use Filament\Schemas\Components\Section; use Ilobegashvili\FilamentComparisonTable\Livewire\ComparisonTableEditor; Section::make('Comparison Table') ->schema([ Livewire::make(ComparisonTableEditor::class, ['column' => 'comparison_table']), ]);
record is injected automatically by Filament — you don't pass it yourself. column defaults to comparison_table if omitted; pass it explicitly when a model needs to store more than one table, or a different column name.
The component saves on every change (column add/remove, row add/remove/reorder, cell blur) — there's no separate save button, and nothing to wire into your form's own submit handler.
Data shape
The component stores its state as:
[
'columns' => [
'en' => ['Feature', 'Price'],
'ka' => ['მახასიათებელი', 'ფასი'],
],
'rows' => [
['id' => '...', 'type' => 'section', 'label_en' => 'Basics', 'label_ka' => '...'],
['id' => '...', 'type' => 'data', 'cells_en' => ['Storage', '10GB'], 'cells_ka' => [...]],
],
]
License
MIT. See LICENSE.md.