panel Appears Unstyled After Adding Custom Theme with Vite
Hello ,
I'm facing a specific issue while trying to apply a custom theme in Filament 4.x on an existing project and would appreciate some guidance.
The Problem
After a successful installation of Filament, my admin panel appears completely unstyled, even though npm run build completes successfully.
My Project Setup
Laravel: v11.45
PHP: v8.2.14
Goal: To apply a custom theme to change the font size of the page headings.
Steps I've Taken
I successfully installed Filament 4.x and can access the login page.
I created a custom theme.css file in resources/css/filament/admin/.
In theme.css, I added an @import for the base Filament styles at the very top, followed by my custom CSS rules.
I registered this file in vite.config.js as an entry point.
I registered the theme in AdminPanelProvider.php using ->viteTheme('...').
I ran npm run build, which completed successfully without any critical Vite errors.
The Result
When I visit the panel, as shown in the attached image. It seems Vite is not correctly linking the custom theme file to the HTML, preventing any styling from being applied.

Solution:Jump to solution
Thank you so much — that was exactly the issue. Adding @tailwindcss/postcss to my postcss.config.js fixed it
15 Replies
have you upgraded your tailwindcss to v4?
yes
Can you paste the content of your custom theme file
here it is
@import '/vendor/filament/filament/resources/css/theme.css';
@import "tailwindcss";
.fi-header-heading {
font-size: 1.5rem !important;
font-weight: 500 !important;
}

you need to add this:
after the theme.css @import, remove the tailwindcss import
Go through the upgrade guide again
These are present by default, but I tried removing them and the result is the same.
Aside filament Panels are other part of the application style working as expected?
All other parts are not styled correctly
The path from your CSS file is probably wrong.
It should be something like this
@import '../../../../vendor/filament/filament/resources/css/theme.css';
Also check the path of your @source
declarationsI deleted everything, then reinstalled npm, updated Vite, and created a default theme.
@import '../../../../vendor/filament/filament/resources/css/theme.css';
@source '../../../../app/Filament//*';
@source '../../../../resources/views/filament//*';
.fi-header-heading {
font-size: 1.0rem !important;
font-weight: 500 !important;
}
However, I got the same result.
I don't know the main reason for this.
I had a similar experience upgrading my v3 project. Does your postcss.config.js contain the following:
You will have to require it via npm @tailwindcss/postcss.
This is assuming you have a postcss.config.js (otherwise make sure you have tailwindcss() plugin in vite.config.js).
The file is created and you can see it in the browsers dev tools? What content does it contain?
Solution
Thank you so much — that was exactly the issue. Adding @tailwindcss/postcss to my postcss.config.js fixed it
the issue is resolved now — thanks a lot for your time
Actually, tailwind has ditched postCss
A project I upgraded recently