Laravel Livewire Tables Documentation

🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.

This is the documentation for v2 but the latest version is v3. You can switch versions in the menu at the top. Check your current version with the following command:

composer show rappasoft/laravel-livewire-tables

Rendering

Rendering Components

You render components the same way you render any Livewire component.

Your component at App\Http\Livewire\UsersTable.php

1<livewire:users-table />

Theme

By default, all components will use the theme in the config file. But if for some reason you have different parts of your application using different frameworks, you can set the theme on a per-table basis:

1<livewire:users-table theme="bootstrap-4" />

Using sub-folders

If your component does not live in App\Http\Livewire, you can specify a different sub-folder. For example if your component lives in App\Http\Livewire\Backend\Users you would use the following:

1<livewire:backend.users.users-table />

Using non-standard locations

If for example you are using Domain Driven Development and you would like your component to live in App\Domains\Auth\Users, then you would register your component in a service provider so Livewire knows how to find it.

For example in LivewireServiceProvider:

1use Livewire\Livewire;
2use App\Domains\Auth\Users\UsersTable;
3 
4public function boot(): void
5{
6 Livewire::component('backend.users.users-table', UsersTable::class);
7}
1<livewire:backend.users.users-table />

Passing Properties

Just like in standard Livewire components, you may pass properties and accept them in your mount method:

1<livewire:invoices-table status="open" />
1// Available as $this->status in datatable class or $status in views (if necessary)
2public string $status;
3 
4// Optional, but if you need to initialize anything
5public function mount(string $status): void {}