diff --git a/.changeset/serious-days-grow.md b/.changeset/serious-days-grow.md
new file mode 100644
index 00000000000..6b7e70d8ea8
--- /dev/null
+++ b/.changeset/serious-days-grow.md
@@ -0,0 +1,6 @@
+---
+'@shopify/polaris': minor
+'polaris.shopify.com': minor
+---
+
+Added support for `paddingInline` and `paddingBlock` on `Box` component with updated documentation
diff --git a/polaris-react/src/components/Box/Box.stories.tsx b/polaris-react/src/components/Box/Box.stories.tsx
index 6eb6a6cb2f7..24a277febc4 100644
--- a/polaris-react/src/components/Box/Box.stories.tsx
+++ b/polaris-react/src/components/Box/Box.stories.tsx
@@ -141,6 +141,69 @@ export function WithBorderRadius() {
);
}
+export function WithPadding() {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
export function WithResponsivePadding() {
return (
diff --git a/polaris-react/src/components/Box/Box.tsx b/polaris-react/src/components/Box/Box.tsx
index 3e57eaf5ad5..4571a9335e1 100644
--- a/polaris-react/src/components/Box/Box.tsx
+++ b/polaris-react/src/components/Box/Box.tsx
@@ -78,6 +78,12 @@ export interface BoxProps extends React.AriaAttributes {
* padding={{xs: '200', sm: '300', md: '400', lg: '500', xl: '600'}}
*/
padding?: Spacing;
+ /** Vertical start and end spacing around children. Accepts a spacing token or an object of spacing tokens for different screen sizes.
+ * @example
+ * paddingBlock='400'
+ * paddingBlock={{xs: '200', sm: '300', md: '400', lg: '500', xl: '600'}}
+ */
+ paddingBlock?: Spacing;
/** Vertical start spacing around children. Accepts a spacing token or an object of spacing tokens for different screen sizes.
* @example
* paddingBlockStart='400'
@@ -90,6 +96,12 @@ export interface BoxProps extends React.AriaAttributes {
* paddingBlockEnd={{xs: '200', sm: '300', md: '400', lg: '500', xl: '600'}}
*/
paddingBlockEnd?: Spacing;
+ /** Horizontal start and end spacing around children. Accepts a spacing token or an object of spacing tokens for different screen sizes.
+ * @example
+ * paddingInline='400'
+ * paddingInline={{xs: '200', sm: '300', md: '400', lg: '500', xl: '600'}}
+ */
+ paddingInline?: Spacing;
/** Horizontal start spacing around children. Accepts a spacing token or an object of spacing tokens for different screen sizes.
* @example
* paddingInlineStart='400'
@@ -169,8 +181,10 @@ export const Box = forwardRef(
outlineStyle,
outlineWidth,
padding,
+ paddingBlock,
paddingBlockStart,
paddingBlockEnd,
+ paddingInline,
paddingInlineStart,
paddingInlineEnd,
role,
@@ -265,27 +279,27 @@ export const Box = forwardRef(
'--pc-box-overflow-y': overflowY,
...getResponsiveProps(
'box',
- 'padding-block-end',
+ 'padding-block-start',
'space',
- paddingBlockEnd || padding,
+ paddingBlockStart || paddingBlock || padding,
),
...getResponsiveProps(
'box',
- 'padding-block-start',
+ 'padding-block-end',
'space',
- paddingBlockStart || padding,
+ paddingBlockEnd || paddingBlock || padding,
),
...getResponsiveProps(
'box',
'padding-inline-start',
'space',
- paddingInlineStart || padding,
+ paddingInlineStart || paddingInline || padding,
),
...getResponsiveProps(
'box',
'padding-inline-end',
'space',
- paddingInlineEnd || padding,
+ paddingInlineEnd || paddingInline || padding,
),
'--pc-box-shadow': shadow ? `var(--p-shadow-${shadow})` : undefined,
'--pc-box-width': width,
diff --git a/polaris.shopify.com/pages/examples/bleed-horizontal.tsx b/polaris.shopify.com/pages/examples/bleed-horizontal.tsx
index 625f39b482d..6f4ad23bd78 100644
--- a/polaris.shopify.com/pages/examples/bleed-horizontal.tsx
+++ b/polaris.shopify.com/pages/examples/bleed-horizontal.tsx
@@ -32,7 +32,12 @@ const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/bleed-specific-direction.tsx b/polaris.shopify.com/pages/examples/bleed-specific-direction.tsx
index 2150c72b71e..ec6d94123f2 100644
--- a/polaris.shopify.com/pages/examples/bleed-specific-direction.tsx
+++ b/polaris.shopify.com/pages/examples/bleed-specific-direction.tsx
@@ -47,7 +47,12 @@ const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/bleed-vertical.tsx b/polaris.shopify.com/pages/examples/bleed-vertical.tsx
index b22745893f8..7e2b3b8a45a 100644
--- a/polaris.shopify.com/pages/examples/bleed-vertical.tsx
+++ b/polaris.shopify.com/pages/examples/bleed-vertical.tsx
@@ -29,7 +29,12 @@ const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/block-stack-with-align.tsx b/polaris.shopify.com/pages/examples/block-stack-with-align.tsx
index 7b39258b043..2c890604cc7 100644
--- a/polaris.shopify.com/pages/examples/block-stack-with-align.tsx
+++ b/polaris.shopify.com/pages/examples/block-stack-with-align.tsx
@@ -59,7 +59,12 @@ const Placeholder = ({
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/block-stack-with-inline-align.tsx b/polaris.shopify.com/pages/examples/block-stack-with-inline-align.tsx
index e8fcb587e02..3cd85548fb7 100644
--- a/polaris.shopify.com/pages/examples/block-stack-with-inline-align.tsx
+++ b/polaris.shopify.com/pages/examples/block-stack-with-inline-align.tsx
@@ -53,7 +53,12 @@ const Placeholder = ({
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/box-with-color.tsx b/polaris.shopify.com/pages/examples/box-with-color.tsx
index 53a66190cb9..83bba2b0de2 100644
--- a/polaris.shopify.com/pages/examples/box-with-color.tsx
+++ b/polaris.shopify.com/pages/examples/box-with-color.tsx
@@ -5,7 +5,7 @@ import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
function BoxWithColorExample() {
return (
-
+
);
diff --git a/polaris.shopify.com/pages/examples/box-with-padding.tsx b/polaris.shopify.com/pages/examples/box-with-padding.tsx
index 71461f6a8c3..166dbf50dcc 100644
--- a/polaris.shopify.com/pages/examples/box-with-padding.tsx
+++ b/polaris.shopify.com/pages/examples/box-with-padding.tsx
@@ -8,37 +8,34 @@ function BoxWithPaddingExample() {
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
);
@@ -69,7 +66,12 @@ const Placeholder = ({
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/box-with-shadow.tsx b/polaris.shopify.com/pages/examples/box-with-shadow.tsx
index 65f1b640fa7..8cf5cacb104 100644
--- a/polaris.shopify.com/pages/examples/box-with-shadow.tsx
+++ b/polaris.shopify.com/pages/examples/box-with-shadow.tsx
@@ -25,7 +25,7 @@ const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/card-with-varying-padding.tsx b/polaris.shopify.com/pages/examples/card-with-varying-padding.tsx
index 7d5ea50b1b4..9b2e76ac50b 100644
--- a/polaris.shopify.com/pages/examples/card-with-varying-padding.tsx
+++ b/polaris.shopify.com/pages/examples/card-with-varying-padding.tsx
@@ -35,7 +35,7 @@ const Placeholder = ({label = '', height = 'auto', width = 'auto'}) => {
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/inline-grid-with-fixed-widths.tsx b/polaris.shopify.com/pages/examples/inline-grid-with-fixed-widths.tsx
index 59a847efca1..81f110d526d 100644
--- a/polaris.shopify.com/pages/examples/inline-grid-with-fixed-widths.tsx
+++ b/polaris.shopify.com/pages/examples/inline-grid-with-fixed-widths.tsx
@@ -37,7 +37,13 @@ const Placeholder = ({
width: width ?? undefined,
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/inline-stack-with-align.tsx b/polaris.shopify.com/pages/examples/inline-stack-with-align.tsx
index 1b14f1b674b..f39f7ff7d80 100644
--- a/polaris.shopify.com/pages/examples/inline-stack-with-align.tsx
+++ b/polaris.shopify.com/pages/examples/inline-stack-with-align.tsx
@@ -69,7 +69,12 @@ const Placeholder = ({
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}
diff --git a/polaris.shopify.com/pages/examples/inline-stack-with-block-align.tsx b/polaris.shopify.com/pages/examples/inline-stack-with-block-align.tsx
index ecaf028d129..2886d336b65 100644
--- a/polaris.shopify.com/pages/examples/inline-stack-with-block-align.tsx
+++ b/polaris.shopify.com/pages/examples/inline-stack-with-block-align.tsx
@@ -81,7 +81,12 @@ const Placeholder = ({
color: 'var(--p-color-text-info-on-bg-fill)',
}}
>
-
+
{label}