React MUI fills properties clockwise
P粉312195700
2023-07-25 10:17:02
<p>Does MuiBox have any populated shorthand properties? for clockwise syntax? </p><p>This is invalid and will cause a syntax error. </p>
<pre class="brush:php;toolbar:false;"><Box padding = {2 1 1 2}/></pre>
<p><br /></p>
Strictly speaking, there will be no such shorthand attribute, and the padding/p attribute only accepts a single spacing value. If you don't want to use the provided long-hand properties (pt, pr, pb, pl) and for some reason need to pass them as a list, the best way is to provide a function to the padding/p property from which Box can be derived value (if you don't want to use sx). For example:
Runnable CodeSandbox example code: : https://codesandbox.io/s/box-padding-example-r6v28m?file=/demo.tsx