F
Filamentβ€’17mo ago
ehbfa

Is this the best way to add a class to a custom widget?

Hey! I've got a custom widget, that I want to style separatly from the other widgets on the dashboard. So in order to do that, I want to get an identifier or class high enough up in the DOM to access it correctly. Currently, I'm doing it like this, which works for me - but I am wondering if this is the correct approach? <x-filament::widget> <div class="my-custom-class"> <x-filament::card> {{-- Widget content --}} </x-filament::card> </div> </x-filament::widget> Any ideas on how to improve on this? Because ideally I would even be one DOM element higher than that with my class definition πŸ™‚
2 Replies
Thijmen
Thijmenβ€’17mo ago
You could add a class the the widget component. <x-filament::widget class="my-custom-class">
ehbfa
ehbfaOPβ€’17mo ago
Ow my, feeling a bit dumb now lol. Thanks for that addition! I'm not used to the new blade components yet...
Want results from more Discord servers?
Add your server