I have a list of 3 buttons I'm trying to display in a grid.
The text of the buttons is dynamic, it could be one word or a full sentence.
I'd like each button's width to be determined thru its content. Make it wide if its a long sentence, keep it small if its 1 word. Example:
On larger screens, I want them to show up in 1 row like the above. On smaller screens I want it to move stuff to the next line if there isn't enough width to show them all in 1 row:
I've been really struggling with getting this to work, because whenever I set grid on the container, the buttons are stretched horizontally to fill up all the space. Or, they're moved to 1 button per row, and still stretched horizontally all the way.
I've tried setting min-width
on everything, I've tried auto-fill
/ auto-fit
and all the different justify
and align
properties and nothing gives me the result I want.
The solution that's working for me now is to just not use any grids and just set a margin top & right on the buttons themselves, and they're aligning themselves the way I want. But I feel like it should be doable through grids.
Is that possible or is the better solution to not use grids for this?