V4 css problem with individual componenst

Hi all! I set up a fresh new Laravel project using the Livewire Starter Kit. While implementing the styling, I ran into an issue. According to the documentation, I need to add a few CSS imports to resources/css/app.css. However, one specific import causes an error: /* Required by actions and infolists */ @import '../../vendor/filament/infolists/resources/css/index.css'; error message (also attached): [plugin:@tailwindcss/vite:generate:serve] Cannot apply unknown utility class: wrap-break-word When I comment out this line, everything compiles correctly, but then I'm missing some styling in certain parts of the UI. I’m using individual Filament components (not the full Filament panel): https://filamentphp.com/docs/4.x/introduction/installation#configuring-styles I’m not sure what the correct approach is for Filament v4, and how the UI supposed to look.
No description
No description
No description
Solution:
try to add @filamentScripts to the head.blade.php
Jump to solution
48 Replies
Booltje124
Booltje124OP3mo ago
No description
Booltje124
Booltje124OP3mo ago
Bump bump
Lirux
Lirux3mo ago
If it's a fresh installation, why'd you install every component individually? Just install the panel builder.
toeknee
toeknee3mo ago
notice he said he isn't using the panel. @Booltje124 why are you choosing not to use the panel, wouldn't you want this for the backend for instance?
Booltje124
Booltje124OP3mo ago
I'm more comfortable working with standalone components, as that's what I'm used to. However, I might consider using the panel as an admin panel in the future.
frame
frame3mo ago
Not sure about the error but at least the styles look similar to this issue https://github.com/filamentphp/filament/issues/16257
GitHub
v4 Some styles don't render properly when Vite dev server is runnin...
Package filament/filament Package Version 4-alpha6 Laravel Version 12 Livewire Version 3 PHP Version 8.4 Problem description Some button styles aren't rendering properly when using the Vite dev...
Booltje124
Booltje124OP3mo ago
That is correct! I have exact the same problem with the toggle buttons. @Lirux @toeknee Do you think it’s possible to replace my custom admin panel with a Filament panel, while still using the custom components elsewhere in my application? Or would that cause any conflicts? I have deleted the custom component via composer and installed the panel. Also deleted the css styles for the individual components in resources/css/app.css. Admin section works fine! But in the main app the css for the individual components is not loading. What could be the problem?
Dan Harrin
Dan Harrin3mo ago
is it the same error? you should npm update if its that error
Booltje124
Booltje124OP3mo ago
After running npm update, I can now include the following stylesheet without any Tailwind errors: /* Required by actions and infolists */ @import '../../vendor/filament/infolists/resources/css/index.css'; However, the custom component CSS is still not loading. Also, when I log in to the application, the first table that loads always has a dropdown menu open by default. When I refresh the page, the issue disappears and doesn’t come back.
No description
Booltje124
Booltje124OP3mo ago
Custom table component:
No description
Dan Harrin
Dan Harrin3mo ago
what is the "custom component css"? you mean tailwind classes in your views?
Booltje124
Booltje124OP3mo ago
Correct The table layout and buttons are not loading
Dan Harrin
Dan Harrin3mo ago
can you send your full css file?
Booltje124
Booltje124OP3mo ago
1 @import 'tailwindcss'; @import '../../vendor/livewire/flux/dist/flux.css'; /* Required by all components */ @import '../../vendor/filament/support/resources/css/index.css'; /* Required by actions and tables */ @import '../../vendor/filament/actions/resources/css/index.css'; /* Required by actions, forms and tables */ @import '../../vendor/filament/forms/resources/css/index.css'; /* Required by actions and infolists */ @import '../../vendor/filament/infolists/resources/css/index.css'; /* Required by notifications */ @import '../../vendor/filament/notifications/resources/css/index.css'; /* Required by actions, infolists, forms, schemas and tables */ @import '../../vendor/filament/schemas/resources/css/index.css'; /* Required by tables */ @import '../../vendor/filament/tables/resources/css/index.css'; /* Required by widgets */ @import '../../vendor/filament/widgets/resources/css/index.css'; @variant dark (&:where(.dark, .dark *)); @source '../views'; @source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php'; @source '../../vendor/livewire/flux-pro/stubs/**/*.blade.php'; @source '../../vendor/livewire/flux/stubs/**/*.blade.php'; @custom-variant dark (&:where(.dark, .dark *)); 2 @theme { --font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; --color-zinc-50: #fafafa; --color-zinc-100: #f5f5f5; --color-zinc-200: #e5e5e5; --color-zinc-300: #d4d4d4; --color-zinc-400: #a3a3a3; --color-zinc-500: #737373; --color-zinc-600: #525252; --color-zinc-700: #404040; --color-zinc-800: #262626; --color-zinc-900: #171717; --color-zinc-950: #0a0a0a; --color-accent: var(--color-neutral-800); --color-accent-content: var(--color-neutral-800); --color-accent-foreground: var(--color-white); } @layer theme { .dark { --color-accent: var(--color-white); --color-accent-content: var(--color-white); --color-accent-foreground: var(--color-neutral-800); } } @layer base { *, ::after, ::before, ::backdrop, ::file-selector-button { border-color: var(--color-gray-200, currentColor); } } [data-flux-field]:not(ui-radio, ui-checkbox) { @apply grid gap-2; } [data-flux-label] { @apply !mb-0 !leading-tight; } input:focus[data-flux-control], textarea:focus[data-flux-control], select:focus[data-flux-control] { @apply outline-hidden ring-2 ring-accent ring-offset-2 ring-offset-accent-foreground; } /* \[:where(&)\]:size-4 { @apply size-4; } */
Dan Harrin
Dan Harrin3mo ago
and which file path are your custom tailwind classes in? and is this file resources/css/app.css or elsewhere?
Booltje124
Booltje124OP3mo ago
Correct! Sorry, i dont know what you mean with the custom tailwind classes?
Dan Harrin
Dan Harrin3mo ago
which view file has the tailwind classes?
Booltje124
Booltje124OP3mo ago
I am using livewire full page components like: Route::get('platforms', ShowPlatforms::class)->name('platforms'); View files are in views->livewire
Dan Harrin
Dan Harrin3mo ago
It seems like your Tailwind setup isnt discovering the classes in your view files, but I don't think thats related to filament you do have @source for the views directory so I would expect that to work tbh actually, have you tried @source '../views/**/*.blade.php'; instead of @source '../views';
Booltje124
Booltje124OP3mo ago
Changed @source, ran npm update again. But same result.
Dan Harrin
Dan Harrin3mo ago
npm update? or npm build?
Booltje124
Booltje124OP3mo ago
Both. First npm update
Dan Harrin
Dan Harrin3mo ago
not sure, sorry. dont think its filament though.
Booltje124
Booltje124OP3mo ago
Strange, but thanks for your help anyway! Just to make sure I understand: Normally, if you install panels using: composer require filament/filament:"^4.0" php artisan filament:install --panels Then you should also be able to use custom components outside of panels without needing to add any additional code, right?
Dan Harrin
Dan Harrin3mo ago
hmm, no, that just installs panels you still need to set up component css and javascript if you want to use components outside of a panel
Booltje124
Booltje124OP3mo ago
Alright, then I think it's working properly now, since I'm no longer seeing the Tailwind error I mentioned in my first post. The only remaining issue is with the table dropdown filter—it only occurs right after logging in and loading a page with a table for the first time. After a refresh, it works fine and the issue doesn't come back.
No description
LeandroFerreira
LeandroFerreira3mo ago
Are you using flux + table builder? Did you create a table widget?
Booltje124
Booltje124OP3mo ago
Yes, using flux (laravel livewire starter kit). Did not create a widget, just a normal table render: https://filamentphp.com/docs/4.x/components/table#adding-the-table
LeandroFerreira
LeandroFerreira3mo ago
could you share the code please? You can use gist for large code
LeandroFerreira
LeandroFerreira3mo ago
I think if you are using a table inside flux dashboard view, you could create a table widget and render it in that view
Booltje124
Booltje124OP3mo ago
Gist
table render
table render. GitHub Gist: instantly share code, notes, and snippets.
LeandroFerreira
LeandroFerreira3mo ago
are you rendering the ShowPlatforms in the dashboard view?
Booltje124
Booltje124OP3mo ago
That's true, but why would that give a different result?
LeandroFerreira
LeandroFerreira3mo ago
I think you can use it as you are doing.. let me check the code..
Booltje124
Booltje124OP3mo ago
Gist
sidebar flux
sidebar flux. GitHub Gist: instantly share code, notes, and snippets.
LeandroFerreira
LeandroFerreira3mo ago
Any console errors in the dashboard page?
Booltje124
Booltje124OP3mo ago
Only for the database-notifications modal. That could maybe also trigger the filter tab on the table? Maybe i have to make a database trigger, like in v3? https://filamentphp.com/docs/3.x/notifications/database-notifications#rendering-the-database-notifications-modal
No description
LeandroFerreira
LeandroFerreira3mo ago
could you remove it temporarily and try again?
LeandroFerreira
LeandroFerreira3mo ago
I don't think it is a Filament issue, because I'm trying a table widget in the flux dashboard and it looks good:
No description
LeandroFerreira
LeandroFerreira3mo ago
Maybe you could create a minimal repo to reproduce this issue and share on Github
Booltje124
Booltje124OP3mo ago
Ok, thanks for now @Leandro Ferreira @Dan Harrin
Booltje124
Booltje124OP3mo ago
Hmmmm. I suddenly see this now
No description
LeandroFerreira
LeandroFerreira3mo ago
add @filamentScripts in the layout
Booltje124
Booltje124OP3mo ago
It's already included. But when I refresh the page, it works fine. The issue only comes back after logging out and logging back in.
Solution
LeandroFerreira
LeandroFerreira3mo ago
try to add @filamentScripts to the head.blade.php
Booltje124
Booltje124OP3mo ago
This is the fix!
Booltje124
Booltje124OP3mo ago
Thank you @LeandroFerreira

Did you find this page helpful?