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:Jump to 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.
6 Replies
Can you share some code? https://filamentphp.com/docs/3.x/forms/actions#controlling-the-horizontal-alignment-of-independent-form-actions might help
VerticalAlignment may help too
This isn't for actions - and those methods aren't available on form elements, either. Trying to vertically align a toggle.
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.
The recommended approach for things like toggles is to have them on their own row.
Ah okay.
Cheers!