How do i change the background color of a Section layout
I have some Sections in a from but i want them to have different background colors. How can i do that ?
Solution:Jump to solution
apperantly i have to add them to the tailwind
safelist
property inside of the content
since they are dynamicly created20 Replies
You can give each section a unique CSS class with
->extraAttributes(['class' => 'my-section'])
i did try that
But it didn't color it
Is the class added? Do you have a custom theme? Check your DevTools
Solution
apperantly i have to add them to the tailwind
safelist
property inside of the content
since they are dynamicly createdYou don’t have to. Is your filament folder added to the
content
config?yes
the
./vendor/filament/**/*.blade.php
yesBut not the Filament file where the classes are defined
this is what i have like content and the presets
Yes. But the Filament file you are defining the classes in, is probably located under
app/Filament/**
?!filament did generate a folder in the
public/css
folder and it did fill it wits its own css filesI am talking about this! Where is that file?
Where do you define
$sectionColor
?I am using only the form builder with a livewire component so i have made it inside App/Http/Livewire
after i upgraded Livewire to v3 it asked me to change the namespacing but decided it will be a headache so i left them there
Then you need to add
app/Http/Livewire/**
to content
so Tailwind scans those files.ouuu
Does it click? 😅
Tailwind can only find classes in files it knows
yes will try it now
nope didn't work
if i do it with
it works
but the default tailwind classes it doesn't recognize them
Are you rebuilding between each change?
npm run dev
Tailwind isn’t some massive stylesheet. It has to rebuild to generate the final stylesheet.yes
did entire cache/view/config/route clears
build + dev
and cleared the browser cache/cookies
Something off in your setup then. Without being able to see the code base it’s going to be hard to help with this.
Weird. But definitely should work, if you include the right files