Post

How do you make a button that doesn't change it's width when it's in a loading state? Use CSS Grid to stack items, and visibility: hidden to hide/show spinner! This approach allows the largest item to size the button, and keeps the button text accessible

Please don't do this. Never hide context to the user while something is loading. You're much better showing the loading state over the content than hiding the content. Here's an example of my loading button:

0 reposts2 likes

In isolation maybe but it feels very natural in real-world situations. It’s far less unnerving than having content disappear during a mutation or action.

Yeah I agree that there are better UI patterns than this. It’s the same with labels that disappear as you start typing