Any ideas how to cause the actions on a custom page to 'stack"

There are have 8 actions on a custom page which off the right side of the page.
I'd like to put them in a grid on desktop view. Mobile wraps nicely. Is this possible make the desktop view wrap or put in grids??
17 Replies
Patrick Boivin
I think you may need a bit of custom CSS for that
ddoddsr
ddoddsrOP2y ago
Would that be on the page like this? <x-filament::page class="grid grid-flow-col grid-cols-1" >
Patrick Boivin
No in a custom CSS file. There's a whole section on custom themes in the docs but if you only need to add simple CSS, you can register a single file:
ddoddsr
ddoddsrOP2y ago
Simple enough to add the file and register it in a provider. What makes it apply to the action button?
Patrick Boivin
In a meeting, I'll circle back with a quick example I think max-width would do (justify-content just to fix the alignment) :
.filament-header .filament-page-actions {
max-width: 500px;
justify-content: flex-end;
}
.filament-header .filament-page-actions {
max-width: 500px;
justify-content: flex-end;
}
ddoddsr
ddoddsrOP2y ago
I'll give that a try tonight, thanks! must be more to it, My npm run dev is running vite & etc. Still no stacking on desktop size window.
Patrick Boivin
Can you try in your browser's CSS inspector? Try adding the max-width rule manually on the .filament-page-actions element. If that works, then it's probably a simple issue loading your custom CSS file.
ddoddsr
ddoddsrOP2y ago
I added max-width:500px to the div with class filament-page-actions and there was no change
awcodes
awcodes2y ago
if you are not using a custom theme and only including css assets then you will need to make your css !important, or use a render hook to force the css to be loaded after Filament's style sheet.
ddoddsr
ddoddsrOP2y ago
If I remove the shrink-0 It wraps witch works for me. filament-page-actions flex flex-wrap items-center gap-4 justify-start shrink-0 Not a css guy so how do I remove that for this page?
Patrick Boivin
You have to customize some of the Blade views which is not ideal. It's easier to add the custom CSS in my opinion.
Dennis Koch
Dennis Koch2y ago
You probably need a: .filament-page-actions { flex-shrink: 1 !important; }
ddoddsr
ddoddsrOP2y ago
my css is not being picked up .
this is in resources/css/my-styles.css .filament-header .filament-page-actions { flex-shrink: 1 !important; } Added this to AppServiceProvider boot method Filament::registerStyles([ asset('css/my-styles.css'), ]); vite config added to input input: [ 'resources/css/app.css', 'resources/css/my-styles.css', 'resources/js/app.js' ], What am I missung? npm run dev is running
awcodes
awcodes2y ago
Vite doesn't use the asset() helper. You'll need to use the Vite facade to get the url.
ddoddsr
ddoddsrOP2y ago
so I added @vite(['resources/css/my-styles.css']) to the page under <x-filament::page> and it works in local. thanks
Patrick Boivin
Just for the record, Vite is great and all but it's totally possible to include a simple CSS file without the any bundling/processing : https://filamentphp.com/docs/2.x/admin/appearance#including-frontend-assets
Want results from more Discord servers?
Add your server