MUI v5: is there a performance difference between styling with system properties and sx prop?

All we need is an easy explanation of the problem, so here it is.

The Migration from v4 to v5 guide indicates:

The Box system props have an optional alternative API in v5, using the sx prop. You can read this section for the "why" behind this new API.

<Box border="1px dashed grey" p={[2, 3, 4]} m={2}>
<Box sx={{ border: "1px dashed grey", p: [2, 3, 4], m: 2 }}>

The referred section indicates:

Having the system under one prop (sx) helps to differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. It’s important for the separation of concerns.

But when it comes to performances, do both ways fall under the benchmark item d. Render 1,000 Box in Performance tradeoff? Or is there any difference between using system properties and sx prop?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

In practice, they should be the same, the system props in some components like Box or Typography will be captured and spread again in the sx prop (Source). So it’d look like this internally:

const { sx: originalSx, ...otherSystemProps } = props;
// sx and system props will be merged into mergedSx
const { ..., mergedSx } = extendSxProp({ originalSx, ...otherSystemProps });

return <BoxRoot sx={mergedSx} {...} />

This means both approach use sx prop under the hood (the slowest styling approach). The one using system properties may be a tad slower because it needs to be merged with the other sx prop internally but I don’t think it’s a big issue here (Both approaches should be equally slow).

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply