F
Filament13mo ago
Oddman

How do I align a form input vertically centered within a grid?

As per title, I have a form element that should be aligned center, but because it's not, looks quite odd.
Solution:
Best thing you can do is use ->extraAttributes() to add a margin top to the component. There’s no feasible way to do this through php because aligning center will not always work if you have descriptions or errors.
Jump to solution
6 Replies
HerrChris
HerrChris13mo ago
VerticalAlignment may help too
Oddman
OddmanOP13mo ago
This isn't for actions - and those methods aren't available on form elements, either. Trying to vertically align a toggle.
Solution
awcodes
awcodes13mo ago
Best thing you can do is use ->extraAttributes() to add a margin top to the component. There’s no feasible way to do this through php because aligning center will not always work if you have descriptions or errors.
awcodes
awcodes13mo ago
The recommended approach for things like toggles is to have them on their own row.
Oddman
OddmanOP13mo ago
Ah okay. Cheers!
Want results from more Discord servers?
Add your server