Filament v3 not detecting Tailwind classes
When i add a text input to have extra attributes like for example
It doesn't color the textinput
My
tailwind.config.js
When i upgraded to Livewire v3 i chose to keep the current namespace App\Htpp\Livewire
thats why that is in the content
key
My filament form is actually in the same folder. I am building the form from a Livewire component. But the styling doesn't render.
What am i missing ?Solution:Jump to solution
I had this same issue. I resolved it but it's hacky. In my case it was that other built-in Filament classes had higher specificity, even though I had the ! for important. The way I handled it was by making a class, in my case called task-urgent. And I made a custom theme that defined this class but specifically targeted the class that was preventing me, like this:
`.task-urgent .text-gray-950 {
@apply !text-red-600;
}...
17 Replies
my postcss.config.js
My app.js
and in my base layout i have the filament, livewire, vite tags
The input probably already has a background color, so you need
!bg-gray-500
. Also check the HTML to see where this is applied. You might need extraInputAttributes()
In the HTML it is applied i just checked but it doesn't color
tried with
bg-red-500
same thing
it is applied in the class
attribute but it doesn't color it
in my layout i have
Then check your DevTools why that's the case
I think the problem is that
vite
doesn't render all of the classes of tailwind and just those that i use
but since these classes are not in a blade file it skips themWe had the same discussion some days ago, right? Doesn't matter whether it's in a Blade file. As long as the file is covered by Tailwinds
content
config.
Check the resulting CSS file whether the class is included. If not, your config isn't right or you didn't recompile your themeyes we had to some point but didn't get it resolve and didn't see my discusion so i made a new one
will check the public css in a moment
as Dennis said, you need to cover all files in your project that have any tailwind css classes, you can achieve this by adding
./app/**/*.php
to your tailwind.config.js file
you can tweak the wildcard to your needs, targeting less files=less build timethe
bg-red-500
class is indeed in the public css fileThen check the DevTools why it's not applied as I mentioned earlier. Probably you need
!important
Solution
I had this same issue. I resolved it but it's hacky. In my case it was that other built-in Filament classes had higher specificity, even though I had the ! for important. The way I handled it was by making a class, in my case called task-urgent. And I made a custom theme that defined this class but specifically targeted the class that was preventing me, like this:
.task-urgent .text-gray-950 {
@apply !text-red-600;
}
This works but WILL break if Filament changes default colors. Not a great solution but CSS specificity is a pain.The problem is not that it doesn't detect the tailwind classes .....the problem is that tailwind doesn't support bg coloring on a input.
From what i see i made it from 'bg-green-200' to text-green-200 and it worked it colored the text
even I am facing a similar issue where the classes used in my div are not getting bundled. The blade.php file is present in resources/views directory (sub directory ... where filament custom page's blade are added - covered with /**/*.blade.php in content), but the styles are not getting into app.css.
To check, i added mt-8 (which is part of standard tailwind classes) to my div. I don't see mt-8 reference in the generated app.css file 😦
problem is that tailwind doesn't support bg coloring on a input.Did you read the previous messages? TW supports bg coloring on an input, but there is a color already applied which needs to be overwriten. See Emaz' answers.
@Dennis Koch even I am facing this issue of classes not getting picked up for my blade file. Have tried adding important (!), but not helping.
Added mt-8 to the class to check, and its not appearing in the generated app.css. So, looks like the file is not getting picked up by vite for bundling even though it is covered in the content.
Any suggestions please 😦
Please open a new help thread and provide your config and filename
I have opened a new thread for my problem alreadt.
https://discord.com/channels/883083792112300104/1164056824614506507
Since this thread too is discussing a similar issue, I commented on one of the replies here as well.
Pl. do check my thread once.
Thanks,