I'm currently available for full time hire! Inquire Here

Laravel Livewire Tables Documentation

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

This is the documentation for 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

Configuration

Publishing Assets

Publishing assets are optional unless you want to customize this package.

Note: I don't recommend you publishing the views unless you really need to change them, and if so, only keep the ones you are changing. Let the package display the rest. The views change quite often and you will miss out on new features or have unforeseeable issues.

1php artisan vendor:publish --provider="Rappasoft\LaravelLivewireTables\LaravelLivewireTablesServiceProvider" --tag=livewire-tables-config
2 
3php artisan vendor:publish --provider="Rappasoft\LaravelLivewireTables\LaravelLivewireTablesServiceProvider" --tag=livewire-tables-views
4 
5php artisan vendor:publish --provider="Rappasoft\LaravelLivewireTables\LaravelLivewireTablesServiceProvider" --tag=livewire-tables-translations
6 
7php artisan vendor:publish --provider="Rappasoft\LaravelLivewireTables\LaravelLivewireTablesServiceProvider" --tag=livewire-tables-public

The default frontend framework is Tailwind, but you also have the option to use Bootstrap 4 or Bootstrap 5 by specifying in the config file.

This is the contents of the published config file:

1<?php
2 
3return [
4 /**
5 * Options: tailwind | bootstrap-4 | bootstrap-5.
6 */
7 'theme' => 'tailwind',
8];

Tailwind Purge

If you find that Tailwind's CSS purge is removing styles that are needed, you have to tell Tailwind to look for the table styles so it knows not to purge them.

In your tailwind.config.js configuration:

1// V2
2module.exports = {
3 mode: 'jit',
4 purge: [
5 ...
6 './vendor/rappasoft/laravel-livewire-tables/resources/views/**/*.blade.php',
7 ],
8 ...
9};
10 
11// V3
12module.exports = {
13 content: [
14 ...
15 './vendor/rappasoft/laravel-livewire-tables/resources/views/**/*.blade.php',
16 ],
17 ...
18};

Tailwind Dark Mode

If you find that the table is consistently displaying in Dark Mode, then you will need to add the following into your tailwind.config.js configuration, keeping in mind that this could impact other components using dark mode!

1module.exports = {
2 darkMode: 'class', // This specifies that Tailwind should look at Class elements to determine dark mode
3...
4};

Alpine.js Cloak

You must also make sure you have this Alpine style available globally. Note that this is configured by default by Livewire after 3.x

1<style>
2 [x-cloak] { display: none !important; }
3</style>

Bypassing Laravel's Auth Service

By default, all events will retrieve any currently authenticated user from Laravel's Auth service and pass it along with the event.

If your project doesn't include the Illuminate/Auth package, or you otherwise want to prevent this, you can set the enableUserForEvent config option to false.

1// config/livewire-tables.php
2return [
3 // ...
4 'events' => [
5 /**
6 * Enable or disable passing the user from Laravel's Auth service to events
7 */
8 'enableUserForEvent' => false,
9 ],
10];