Skip to content


The Box component serves as a wrapper component for most of the CSS utility needs.

The Box component packages all the style functions that are exposed in @mui/system.


The palette style function.

The sx prop

All system properties are available via the sx prop. In addition, the sx prop allows you to specify any other CSS rules you may need. Here's an example of how you can use it:

Press Enter to start editing

Overriding Material UI components

The Box component wraps your component. It creates a new DOM element, a <div> that by default can be changed with the component prop. Let's say you want to use a <span> instead:

Press Enter to start editing

This works great when the changes can be isolated to a new DOM element. For instance, you can change the margin this way.

However, sometimes you have to target the underlying DOM element. As an example, you may want to change the border of the Button. The Button component defines its own styles. CSS inheritance doesn't help. To workaround the problem, you can use the sx prop directly on the child if it is a Material UI component.

-<Box sx={{ border: '1px dashed grey' }}>
-  <Button>Save</Button>
+<Button sx={{ border: '1px dashed grey' }}>Save</Button>

For non-Material UI components, use the component prop.

-<Box sx={{ border: '1px dashed grey' }}>
-  <button>Save</button>
+<Box component="button" sx={{ border: '1px dashed grey' }}>Save</Box>

System props

As a CSS utility component, the Box also supports all system properties. You can use them as prop directly on the component. For instance, a margin-top:

<Box mt={2}>


See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.