F
Filamentβ€’11mo ago
Dave Mack

Changing the colour of field labels where a form is inside a standalone livewire component.

I am following the docs and have been able to generate a form that I can use inside my Livewire component. My issue is that my page design is quite dark, and I would want to change the colour of the labels to be white. It looks like the ->extraAttributes feature will only work on the actual field. Is there any way that I can control the label colour from within the livewire/filament component?
If I need to create a theme for this form - I also couldn't see how to associate the theme with the individual form inside my livewire component.
I'd love some advice! πŸ™‚
Solution:
Thanks Patrick - great idea! Thanks!
Jump to solution
2 Replies
Patrick Boivin
Patrick Boivinβ€’11mo ago
One solution would be to wrap the field(s) in a Group component, and apply a custom CSS class on it:
Group::make([
// Form field here
])->extraAttributes(['class' => 'my-custom-class']),
Group::make([
// Form field here
])->extraAttributes(['class' => 'my-custom-class']),
You could target specifically the labels in this Group
Solution
Dave Mack
Dave Mackβ€’11mo ago
Thanks Patrick - great idea! Thanks!