UI Theme Override โ
The global theme comes from config('livewire-powergrid.theme'). Override it on one table with template().
template() โ
Return a Theme instance from template(). This is the v7 hook (PowerGridComponent::template(): ?Theme).
phpapp/Livewire/ProductTable.php
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
use PowerComponents\LivewirePowerGrid\Themes\Theme;
use App\PowerGridThemes\MyTheme;
class ProductTable extends PowerGridComponent
{
public function template(): ?Theme
{
return new MyTheme();
}
}customThemeClass(): ?string is deprecated (since 7.x). It still returns a class name (or a registered theme key). If both are set, template() wins.
phpapp/Livewire/ProductTable.php
public function customThemeClass(): ?string
{
return MyTheme::class;
}Resolution in boot(): template() if it returns a Theme; otherwise customThemeClass(); otherwise config('livewire-powergrid.theme').
Patch Tokens on the Active Theme โ
You do not need a new class to change a few classes on one table. Call merge() on a built-in theme:
phpapp/Livewire/ProductTable.php
use PowerComponents\LivewirePowerGrid\Themes\Tailwind;
use PowerComponents\LivewirePowerGrid\Themes\Theme;
public function template(): ?Theme
{
return Tailwind::make()->merge([
'table' => [
'layout' => [
'tr' => 'stripe hover:bg-yellow-50',
],
],
]);
}To restyle every table without PHP, use theme_overrides in config. See Custom Theme.
