Disable System Theme from Theme Switcher

Hey Guys! Is there a way to disable system theme from theme switcher in the filament user-menu? i know that you can disable the whole dark mode settings, but i only want to disable system theme...
8 Replies
Patrick Boivin
A simple solution would be to hide the button via CSS.
xy
xy2y ago
But isn't the system theme enabled by default?
Patrick Boivin
Yes. I guess the user would need to select light/dark if what they get from the system is not what they like. Another option would be to publish and customize this view: vendor/filament/filament/resources/views/components/theme-switcher/index.blade.php but this is generally not recommended
Jan0bra
Jan0braOP2y ago
thanks for the answers! why isnt it recommended to publish the view?
xy
xy2y ago
I assume because of upstream changes (changes in the main package that will not accurately reflect if you publish views)
Patrick Boivin
Here's an article that explains the main issues: https://filamentphp.com/community/danharrin-publishing-views-in-laravel
Filament
Publishing Views in Laravel by Dan Harrin - Filament
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
Patrick Boivin
Ultimately, Laravel allows it so it's a valid option. But you have to keep up with the changes in the rest of the package. It becomes your responsibility.
Jan0bra
Jan0braOP2y ago
thank you very much for the explanation

Did you find this page helpful?