awcodes/filament-table-repeater
Installation:
composer require awcodes/filament-table-repeater
Publish the config (if needed):
php artisan vendor:publish --provider="Awcodes\TableRepeater\TableRepeaterServiceProvider"
Register the Plugin:
Add to app/Providers/Filament/AdminPanelProvider.php:
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
\Awcodes\TableRepeater\TableRepeaterPlugin::make(),
]);
}
First Use Case:
Replace a standard Repeater with TableRepeater in a form:
use Awcodes\TableRepeater\Forms\Components\TableRepeater;
TableRepeater::make('items')
->columns(3) // Optional: Adjust column count
->schema([
TextInput::make('name'),
Select::make('status')->options(['active', 'inactive']),
])
->columnSpanFull(), // Optional: Full-width on small screens
Form Integration:
Repeater with TableRepeater in Filament forms for tabular data entry.TableRepeater::make('features')
->columns(2)
->schema([
Toggle::make('enabled'),
TextInput::make('description'),
])
->columnSpanFull(),
Dynamic Columns:
columns() to adjust responsiveness (e.g., columns(1) for mobile).columnSpanFull() for full-width on small screens.Nested Repeaters:
TableRepeater inside another Repeater for hierarchical data:Repeater::make('categories')
->schema([
TableRepeater::make('subcategories')
->columns(1)
->schema([...]),
]),
Conditional Rendering:
visible() or rules() to show/hide based on logic:TableRepeater::make('pricing')
->columns(2)
->visible(fn ($record) => $record->is_subscription()),
Theming: Ensure your resources/css/filament/app.css includes:
@import 'filament-table-repeater/dist/table-repeater.css';
Run npm run dev after updates.
Validation: Leverage rules() for row-level validation:
TableRepeater::make('tasks')
->schema([
TextInput::make('title')
->required()
->maxLength(50),
]),
Livewire Sync: Works seamlessly with Filament’s Livewire integration—no extra setup.
Deprecation Warning:
TableRepeater instead:
Repeater::make('items')
->table()
->columns(3)
->schema([...]),
CSS Conflicts:
npm run dev
.filament-table-repeater { /* Overrides */ }
Performance:
livewire:ignore on the repeater to avoid re-rendering:
TableRepeater::make('logs')
->livewireIgnore()
->columns(1),
Column Alignment:
columnSpanFull() is used without proper padding. Add:
.filament-table-repeater .filament-table-repeater-item {
padding: 0.5rem;
}
Console Errors:
filament-table-repeater.js for missing dependencies. Ensure:
npm install
is run after composer install.Data Binding:
name attribute matches the model’s fillable fields:
// Model must have:
protected $fillable = ['items']; // Array of repeater data
Custom Headers:
headers():
TableRepeater::make('users')
->columns(2)
->headers([
'Name' => 'name',
'Role' => 'role',
]),
Row Actions:
actions():
TableRepeater::make('orders')
->columns(1)
->actions([
Action::make('edit')
->icon('heroicon-o-pencil')
->url(fn ($record) => route('orders.edit', $record)),
]),
Server-Side Processing:
Filament’s Table component for pagination:
use Filament\Tables\Table;
Table::make()
->columns([
TableColumn::make('items')
->badge()
->counts(),
]),
How can I help you explore Laravel packages today?