Tailwind css are not working in custom page .

Tailwind css are not working in custom page . Classes are not detecting.
18 Replies
Dennis Koch
Dennis Koch8mo ago
That's how Tailwind works. It's a fixed set of classes that are included inside Filament. If you need more, you need to create a theme and compile your own stylesheet.
ocram82
ocram828mo ago
Sorry, i've the same problem. How can i make work Tailwind css inside a custom page? thanks
Dennis Koch
Dennis Koch8mo ago
Did you read my answer?
ocram82
ocram828mo ago
yes, but i won't more than that. I only would make work tailwindcss inside my custom page. Do i miss something that i can't understand?
Dennis Koch
Dennis Koch8mo ago
So you don’t have any styling on your custom page?
ocram82
ocram828mo ago
The following example can exaplain. I've created a custom page. and in the blade i've this:
<x-filament-panels::page>
<div class="bg-green-500 w-full p-8 border border-gray-900">
<p>Ciao</p>
<p>
<i class="fa-solid fa-right-to-bracket mr-1"></i>
</p>
</div>
</x-filament-panels::page>
<x-filament-panels::page>
<div class="bg-green-500 w-full p-8 border border-gray-900">
<p>Ciao</p>
<p>
<i class="fa-solid fa-right-to-bracket mr-1"></i>
</p>
</div>
</x-filament-panels::page>
But for example bg-green-500 and other classes can't work
Dennis Koch
Dennis Koch8mo ago
But you have styling? It’s just some classes that don’t work? Then my answer above applies to you too
ocram82
ocram828mo ago
yes i have, the other part of the page, for example the title or the sidebar is correctly rendered filament/tailwind is imported as i can see exploring the page code
Samir
Samir8mo ago
Filament custom pages belong to a specific panel. From my understing, it will render the theme specific to the panel. If you have custom styles, you need to extend the theme. You need to extend tauwing.config.js in your resources/css/filament/<panel_folder>/. All your extra colors must extend. Then build again.
Samir
Samir8mo ago
Look into my commented section in my attached code, how I tried extending my theme.
ocram82
ocram828mo ago
Sorry but i still don't understand how can i have Tailwind in my custom pages...
Dennis Koch
Dennis Koch8mo ago
Again: If you want custom classes that are not part of Filaments Tailwind build you need a theme. Follow the theme docs for instructions.
ocram82
ocram828mo ago
i've just done it following https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme . That was so easy! Thanks and sorry if i didn't understand what "create a theme" means! Now it's clear. Thanks a lot for your patience
Matthew
Matthew8mo ago
Saying that you want tailwind in your pages is trivial, as tailwind css is built WITHIN filament. That means that every styling you see, is done with tailwind css. Nice! Note, if you add existing classes in your theme, filament will replace its classes with yours
ocram82
ocram828mo ago
the default behavior for custom pages is that they don't get tailwindcss classes. only after creating a theme and some configuration for that specific panel you have tailwind in your custom pages
Samir
Samir8mo ago
No. Your understanding is not correct. Filament comes bundled with Tailwind. It is just that in filament don't have all of Tailwind classes which are being used for the theme. In Tailwind you can define your presets which include only those classes which you want to use. Filament has created its own preset of selected classes. Unfortunately, there is no documentation on the website about tailwind preset classes used in Filament. So, you have to dig into the code. This is why Filament recommends creating your own theme for each panel. In each theme, you can either extend the existing theme (which is recommended) or you can entirely have your own theme with your set of classes.
Strangler
Strangler7mo ago
Just want to say I've had this issue for hours and I couldn't wrap my head around it, but this solved my issue. Thanks!