I've recently started exploring Material UI, but I'm having trouble understanding how the spacing properties function. I'm trying to utilize the "spacing" feature for various elements, but it appears that it only works for "Box" components and not for elements like "Buttons."
According to the Material UI spacing section, we can use m
or p
to add margin or padding. However, when trying to incorporate these properties into a Button
component, they do not seem to have any effect:
<Button variant="contained" color="primary" mt={2}>
Primary
</Button>
Even though I'm using mt
(margin-top property) and following the documentation, which states it should apply a margin-top of 8px, it doesn't seem to be setting anything...
So, my question remains, what are the specific elements where we can successfully apply spacing properties in Material UI, and where might I be going wrong in my example?