F
Filament9mo 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
HerrChris9mo ago
VerticalAlignment may help too
Oddman
Oddman9mo ago
This isn't for actions - and those methods aren't available on form elements, either. Trying to vertically align a toggle.
Solution
awcodes
awcodes9mo 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
awcodes9mo ago
The recommended approach for things like toggles is to have them on their own row.
Oddman
Oddman9mo ago
Ah okay. Cheers!
Want results from more Discord servers?
Add your server
More Posts