Livewire component grid in template does not render as grid col, unless use col-start-*

Hello, I'm using a custom Livewire component in a Filament form. I'm trying to display a label and a value in a 2 column format using .grid-cols-2, but it does not render like so (cf. screenshot #1). If I use .col-start-1 for the label and .col-start-2 for the value, it works, but I think it's not a normal behavior. Here is the code in my blade template:
<div class="grid grid-cols-2 gap-4 text-sm">
<div>Label</div>
<div class="text-right">25.55 €</div>
</div>
<div class="grid grid-cols-2 gap-4 text-sm">
<div>Label</div>
<div class="text-right">25.55 €</div>
</div>
Do I miss something? I tried to install Tailwind as explained in the documentation but nothing changed. Thank you for your help!
No description
12 Replies
Dennis Koch
Dennis Koch5mo ago
Is that blade file or folder included in the content option of the tailwind config? Check grid-cols-2 in the DevTools. Are there any rules applied? If not it's probably missing and you didn't rebuild your TailwindCSS file properly
Adysone
AdysoneOP5mo ago
I don't have a tailwind config because I use the panel builder, and as far as I understand, It's not necessary to install Tailwind. But I'll install it and check in the config file the paths (there was not the path of my livewire component when I tried). Thank you
Adysone
AdysoneOP5mo ago
My app.css file is not "updated". I ran npm run dev and npm run build. Here are ./tailwind.config.js and ./resources/css/app.css My blade component is located here: ./resources/views/livewire/price-grid.blade.php In my compiled app.css, I can find only md:grid-cols-2, but not grid-cols-2.
No description
Dennis Koch
Dennis Koch5mo ago
I don't have a tailwind config because I use the panel builde
Okay, because you said you set up everything according to the docs and pointed to the "form builder" docs.
It's not necessary to install Tailwind
Not as long as you don't need custom classes. You should follow the theme docs and create a custom theme.
Adysone
AdysoneOP5mo ago
I set up everything according to the docs of the Form Builder because I thought I could be a solution. But it's clearly not. I don't need custom theme, I just need to use grid-cols-2, but it's not in the app.css and I can't understand why it's not.
Dennis Koch
Dennis Koch5mo ago
Trust me: You need a custom theme. Why should it be in app.css? It’s a panel? You aren’t using app.css in the panel.
Adysone
AdysoneOP5mo ago
I made a mistake, it has nothing to do with app.css. But why do I need a custom theme if I just want to use standard classes of Tailwind?
Dennis Koch
Dennis Koch5mo ago
Because Tailwind only includes the classes you actually use to reduce the build size. When you add new classes you can't use the file from the Filament codebase anymore.
Adysone
AdysoneOP5mo ago
Oh OK, I thought Filament CSS was rebuilt including the classes I use. That makes sense. I'll see how Ican do all of that. Thanks!
Dennis Koch
Dennis Koch5mo ago
I thought Filament CSS was rebuilt including the classes I use
Through which tooling? That would require all the npm packages to be auto-installed on every system and nodejs to be preseent in the right version, ...
Adysone
AdysoneOP5mo ago
I installed npm packages and I ran npm run build, but nothing changed when I did this. But I found this thanks to your message, and I went with a custom theme, it seems to be good now!
Filament
How can I compile new Tailwind CSS classes in a panel? by Dan Harri...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
Want results from more Discord servers?
Add your server