openplain/filament-shadcn-theme
composer require openplain/filament-shadcn-theme
php artisan vendor:publish --provider="Openplain\FilamentShadcnTheme\FilamentShadcnThemeServiceProvider" --tag="config"
app/Providers/AppServiceProvider.php:
use Openplain\FilamentShadcnTheme\Facades\FilamentShadcnTheme;
public function boot(): void
{
FilamentShadcnTheme::apply();
}
Replace Filament’s default theme with Shadcn’s Default theme (light/dark-aware) in 5 minutes:
// config/filament.php
'panel' => [
'theme' => Openplain\FilamentShadcnTheme\FilamentShadcnTheme::class,
],
No additional CSS or JS required—colors adapt dynamically.
Override default colors via config (config/filament-shadcn-theme.php):
'colors' => [
'primary' => [
'light' => '#1e293b', // Dark charcoal (light mode)
'dark' => '#f8fafc', // Light gray (dark mode)
],
'danger' => [
'light' => '#dc2626',
'dark' => '#fecaca',
],
],
Pro Tip: Use Shadcn’s color palette for consistency.
Apply the theme only to specific panels (e.g., admin vs. public dashboard):
// In a Filament Panel provider
public function panel(Panel $panel): Panel
{
return $panel
->theme(FilamentShadcnTheme::class)
->id('admin');
}
Leverage Shadcn’s UI system for custom Filament widgets:
use Openplain\FilamentShadcnTheme\Components\ShadcnButton;
ShadcnButton::make('Submit')
->action(fn () => /* ... */)
->color('primary'),
Note: The package includes pre-built Shadcn-compatible components (e.g., ShadcnCard, ShadcnInput).
Automatically sync Filament’s dark mode with the user’s OS preference:
// app/Providers/AppServiceProvider.php
use Openplain\FilamentShadcnTheme\Facades\FilamentShadcnTheme;
public function boot(): void
{
FilamentShadcnTheme::apply();
FilamentShadcnTheme::enableSystemDarkMode();
}
Ensure form inputs and table cells respect the theme:
use Openplain\FilamentShadcnTheme\Components\ShadcnTextInput;
TextInput::make('name')
->columnSpanFull()
->extraAttributes(['class' => 'shadcn-input']), // Uses Shadcn styles
Caching Issues:
php artisan filament:cache:clear
Conflicting CSS:
background-color: #3b82f6) override the theme.--filament-primary-500 CSS variables instead.Dark Mode Detection Lag:
use Openplain\FilamentShadcnTheme\Facades\FilamentShadcnTheme;
Button::make('Toggle Dark Mode')
->action(fn () => FilamentShadcnTheme::toggleDarkMode()),
--filament-primary-* variables are applied.FilamentShadcnTheme::on('theme-applied', fn () => Log::info('Theme applied!'));
Add Custom Themes:
Create a new theme class by extending FilamentShadcnTheme:
class CustomShadcnTheme extends FilamentShadcnTheme
{
protected function getColors(): array
{
return [
'primary' => ['light' => '#3b82f6', 'dark' => '#60a5fa'],
];
}
}
Register it in config/filament-shadcn-theme.php:
'themes' => [
'custom' => CustomShadcnTheme::class,
],
Override Component Styles: Publish the package’s assets and modify:
php artisan vendor:publish --provider="Openplain\FilamentShadcnTheme\FilamentShadcnThemeServiceProvider" --tag="assets"
Edit resources/css/filament-shadcn-theme.css.
Localization: The package supports RTL (right-to-left) layouts. Ensure your Filament config includes:
'direction' => 'rtl',
shadcn-ui/laravel for consistent styling across your app.How can I help you explore Laravel packages today?