Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.
Box
The Box component is a foundational layout primitive that controls padding, sizing, and visibility of its children. Use Box to add spacing around content, constrain dimensions, or toggle visibility without introducing stacking or alignment behavior.
For arranging multiple children in a vertical or horizontal flow, use BlockStack or InlineStack. For semantic grouping with a heading, use Section.
Supported targets
- admin.
abandoned-checkout-details. action. render - admin.
abandoned-checkout-details. block. render - admin.
catalog-details. action. render - admin.
catalog-details. block. render - admin.
collection-details. action. render - admin.
collection-details. block. render - admin.
collection-index. action. render - admin.
company-details. action. render - admin.
company-details. block. render - admin.
company-location-details. block. render - admin.
customer-details. action. render - admin.
customer-details. block. render - admin.
customer-index. action. render - admin.
customer-index. selection-action. render - admin.
customer-segment-details. action. render - admin.
discount-details. action. render - admin.
discount-details. function-settings. render - admin.
discount-index. action. render - admin.
draft-order-details. action. render - admin.
draft-order-details. block. render - admin.
draft-order-index. action. render - admin.
draft-order-index. selection-action. render - admin.
gift-card-details. action. render - admin.
gift-card-details. block. render - admin.
order-details. action. render - admin.
order-details. block. render - admin.
order-details. print-action. render - admin.
order-fulfilled-card. action. render - admin.
order-index. action. render - admin.
order-index. selection-action. render - admin.
order-index. selection-print-action. render - admin.
product-details. action. render - admin.
product-details. block. render - admin.
product-details. configuration. render - admin.
product-details. print-action. render - admin.
product-details. reorder. render - admin.
product-index. action. render - admin.
product-index. selection-action. render - admin.
product-index. selection-print-action. render - admin.
product-purchase-option. action. render - admin.
product-variant-details. action. render - admin.
product-variant-details. block. render - admin.
product-variant-details. configuration. render - admin.
product-variant-purchase-option. action. render - admin.
settings. order-routing-rule. render - admin.
settings. validation. render
Supported targets
- admin.
abandoned-checkout-details. action. render - admin.
abandoned-checkout-details. block. render - admin.
catalog-details. action. render - admin.
catalog-details. block. render - admin.
collection-details. action. render - admin.
collection-details. block. render - admin.
collection-index. action. render - admin.
company-details. action. render - admin.
company-details. block. render - admin.
company-location-details. block. render - admin.
customer-details. action. render - admin.
customer-details. block. render - admin.
customer-index. action. render - admin.
customer-index. selection-action. render - admin.
customer-segment-details. action. render - admin.
discount-details. action. render - admin.
discount-details. function-settings. render - admin.
discount-index. action. render - admin.
draft-order-details. action. render - admin.
draft-order-details. block. render - admin.
draft-order-index. action. render - admin.
draft-order-index. selection-action. render - admin.
gift-card-details. action. render - admin.
gift-card-details. block. render - admin.
order-details. action. render - admin.
order-details. block. render - admin.
order-details. print-action. render - admin.
order-fulfilled-card. action. render - admin.
order-index. action. render - admin.
order-index. selection-action. render - admin.
order-index. selection-print-action. render - admin.
product-details. action. render - admin.
product-details. block. render - admin.
product-details. configuration. render - admin.
product-details. print-action. render - admin.
product-details. reorder. render - admin.
product-index. action. render - admin.
product-index. selection-action. render - admin.
product-index. selection-print-action. render - admin.
product-purchase-option. action. render - admin.
product-variant-details. action. render - admin.
product-variant-details. block. render - admin.
product-variant-details. configuration. render - admin.
product-variant-purchase-option. action. render - admin.
settings. order-routing-rule. render - admin.
settings. validation. render
Anchor to PropertiesProperties
Props for the Box component, a generic layout container. Box doesn't define any props of its own. It inherits accessibility, sizing, padding, and display props from shared interfaces.
- Anchor to accessibilityRoleaccessibilityRoleaccessibilityRoleAccessibilityRoleAccessibilityRoleDefault: 'generic'Default: 'generic'
The semantic meaning of the component’s content. When set, the role will be used by assistive technologies to help users navigate the page.
- Anchor to blockSizeblockSizeblockSizenumber | `${number}%`number | `${number}%`
The block size (height in horizontal writing modes) of the element.
number: The size in pixels.`${number}%`: The size as a percentage of the parent container's block size.
Learn more about the block-size property.
- Anchor to displaydisplaydisplay'auto' | 'none''auto' | 'none'Default: 'auto'Default: 'auto'
Whether the element is rendered and takes up space in the layout.
auto: The element is rendered normally and participates in layout.none: The element isn't rendered at all and doesn't take up any space. Use this to conditionally hide content without removing it from the component tree.
- Anchor to inlineSizeinlineSizeinlineSizenumber | `${number}%`number | `${number}%`
The inline size (width in horizontal writing modes) of the element.
number: The size in pixels.`${number}%`: The size as a percentage of the parent container's inline size.
Learn more about the inline-size property.
- Anchor to maxBlockSizemaxBlockSizemaxBlockSizenumber | `${number}%`number | `${number}%`
The maximum block size (maximum height in horizontal writing modes). The element won't grow taller than this value even if its content is longer.
number: The size in pixels.`${number}%`: The size as a percentage of the parent container's block size.
Learn more about the max-block-size property.
- Anchor to maxInlineSizemaxInlineSizemaxInlineSizenumber | `${number}%`number | `${number}%`
The maximum inline size (maximum width in horizontal writing modes). The element won't grow wider than this value.
number: The size in pixels.`${number}%`: The size as a percentage of the parent container's inline size.
Learn more about the max-inline-size property.
- Anchor to minBlockSizeminBlockSizeminBlockSizenumber | `${number}%`number | `${number}%`
The minimum block size (minimum height in horizontal writing modes). The element won't shrink smaller than this value even if its content is shorter.
number: The size in pixels.`${number}%`: The size as a percentage of the parent container's block size.
Learn more about the min-block-size property.
- Anchor to minInlineSizeminInlineSizeminInlineSizenumber | `${number}%`number | `${number}%`
The minimum inline size (minimum width in horizontal writing modes). The element won't shrink narrower than this value.
number: The size in pixels.`${number}%`: The size as a percentage of the parent container's inline size.
Learn more about the min-inline-size property.
- Anchor to paddingpaddingpaddingMaybeAllBoxEdgesShorthandProperty<SpacingKeyword | boolean>MaybeAllBoxEdgesShorthandProperty<SpacingKeyword | boolean>
The padding on all edges of the element, using a shorthand syntax. You can specify one to four values following the CSS shorthand convention.
When set to
true, applies a default padding appropriate for the component.- Anchor to paddingBlockpaddingBlockpaddingBlockMaybeTwoBoxEdgesShorthandProperty<SpacingKeyword | boolean>MaybeTwoBoxEdgesShorthandProperty<SpacingKeyword | boolean>
The padding on the block-start and block-end edges. When set to
true, applies a default block padding appropriate for the component.Learn more about the padding-block property.
- Anchor to paddingBlockEndpaddingBlockEndpaddingBlockEndSpacingKeyword | booleanSpacingKeyword | boolean
The padding on the block-end edge (the bottom edge in horizontal writing modes). When set to
true, applies a default padding appropriate for the component.Learn more about the padding-block-end property.
- Anchor to paddingBlockStartpaddingBlockStartpaddingBlockStartSpacingKeyword | booleanSpacingKeyword | boolean
The padding on the block-start edge (the top edge in horizontal writing modes). When set to
true, applies a default padding appropriate for the component.Learn more about the padding-block-start property.
- Anchor to paddingInlinepaddingInlinepaddingInlineMaybeTwoBoxEdgesShorthandProperty<SpacingKeyword | boolean>MaybeTwoBoxEdgesShorthandProperty<SpacingKeyword | boolean>
The padding on the inline-start and inline-end edges. When set to
true, applies a default inline padding appropriate for the component.Learn more about the padding-inline property.
- Anchor to paddingInlineEndpaddingInlineEndpaddingInlineEndSpacingKeyword | booleanSpacingKeyword | boolean
The padding on the inline-end edge (the right edge in left-to-right writing modes). When set to
true, applies a default padding appropriate for the component.Learn more about the padding-inline-end property.
- Anchor to paddingInlineStartpaddingInlineStartpaddingInlineStartSpacingKeyword | booleanSpacingKeyword | boolean
The padding on the inline-start edge (the left edge in left-to-right writing modes). When set to
true, applies a default padding appropriate for the component.Learn more about the padding-inline-start property.
AccessibilityRole
The set of accessibility roles that can be applied to layout components to convey semantic meaning to assistive technologies. Each role maps to a corresponding HTML element or ARIA role in web-based hosts. - `main`: The primary content of the page. - `header`: A header section of the page. - `footer`: A section for copyright information, navigation links, and privacy statements. - `section`: A generic section; should have a heading or accessible label. - `aside`: A supporting section related to the main content. - `navigation`: A major group of navigation links. - `ordered-list`: A list of ordered items. - `list-item`: An item inside a list. - `list-item-separator`: A divider that separates items in a list. - `unordered-list`: A list of unordered items. - `separator`: A divider separating sections of content. - `status`: A live region with advisory information that isn't urgent enough to be an alert. - `alert`: Important, usually time-sensitive information. - `generic`: A nameless container with no semantic meaning on its own.
'main' | 'header' | 'footer' | 'section' | 'aside' | 'navigation' | 'ordered-list' | 'list-item' | 'list-item-separator' | 'unordered-list' | 'separator' | 'status' | 'alert' | 'generic'MaybeAllBoxEdgesShorthandProperty
A shorthand type that accepts one to four spacing values following the CSS box-edge shorthand convention (block-start, inline-end, block-end, inline-start). - One value (such as `base`): Applied to all four edges. - Two values (such as `base none`): The first is applied to block-start and block-end, the second to inline-start and inline-end. - Three values (such as `base none large`): The first is block-start, the second is inline-start and inline-end, the third is block-end. - Four values (such as `base none large small`): Applied to block-start, inline-end, block-end, and inline-start respectively.
T | `${T} ${T}` | `${T} ${T} ${T}` | `${T} ${T} ${T} ${T}`SpacingKeyword
A keyword that maps to a predefined spacing value from the Shopify admin design system. Use these instead of pixel values to ensure consistent spacing throughout the UI. - `none`: No spacing (0px). - `small`: A compact amount of spacing, suitable for tight layouts. - `base`: The default spacing, appropriate for most layouts. - `large`: A generous amount of spacing, used to create visual separation.
'none' | 'small' | 'base' | 'large'MaybeTwoBoxEdgesShorthandProperty
A shorthand type that accepts one or two spacing values, representing the start and end edges of a single axis (block or inline). - One value (such as `base`): Applied to both the start and end edges. - Two values (such as `base none`): The first is applied to the start edge, the second to the end edge.
T | `${T} ${T}`Anchor to ExamplesExamples
Anchor to Create a padded content containerCreate a padded content container
Add padding around a warehouse slot name, aisle reference, and unit count. This example uses Box with padding inside a BlockStack to inset the slot details from the heading above.
Create a padded content container
 to inset the slot details from the heading above.](https://cdn.shopify.com/shopifycloud/shopify-dev/production/assets/assets/images/templated-apis-screenshots/admin-extensions/2025-07/box-default-DwY2Ox1R.png)
Create a padded content container
React
import {reactExtension, Box, Text, BlockStack} from '@shopify/ui-extensions-react/admin';
function App() {
return (
<BlockStack gap>
<Text fontWeight="bold">Warehouse slot</Text>
<Box padding="base">
<Text fontWeight="bold">Slot A-42</Text>
<Text>Aisle A, Rack 4, Shelf 2</Text>
<Text>24 units stored</Text>
</Box>
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.block.render',
() => <App />,
);TS
import {extension, Box, Text, BlockStack} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.block.render',
(root) => {
const stack = root.createComponent(BlockStack, {gap: true});
const heading = root.createComponent(Text, {fontWeight: 'bold'}, 'Warehouse slot');
const card = root.createComponent(Box, {
padding: 'base',
});
const slot = root.createComponent(Text, {fontWeight: 'bold'}, 'Slot A-42');
const location = root.createComponent(Text, {}, 'Aisle A, Rack 4, Shelf 2');
const status = root.createComponent(Text, {}, '24 units stored');
card.appendChild(slot);
card.appendChild(location);
card.appendChild(status);
stack.appendChild(heading);
stack.appendChild(card);
root.appendChild(stack);
},
);Anchor to Constrain image dimensionsConstrain image dimensions
Constrain an Image to a fixed size using inlineSize and blockSize props. This example creates a thumbnail container alongside product details in an InlineStack, preventing the image from stretching beyond its bounds.
Constrain image dimensions
React
import {reactExtension, Box, Image, Text, InlineStack, BlockStack} from '@shopify/ui-extensions-react/admin';
function App() {
return (
<BlockStack gap>
<InlineStack gap>
<Box inlineSize={80} blockSize={80}>
<Image
source="https://cdn.shopify.com/s/files/placeholder-images/product.png"
accessibilityLabel="Product thumbnail"
/>
</Box>
<Box>
<Text fontWeight="bold">Premium Widget</Text>
<Text>SKU: WH-1234</Text>
<Text>$49.99</Text>
</Box>
</InlineStack>
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.block.render',
() => <App />,
);TS
import {extension, Box, Image, Text, InlineStack, BlockStack} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.block.render',
(root) => {
const stack = root.createComponent(BlockStack, {gap: true});
const row = root.createComponent(InlineStack, {gap: true});
const imageBox = root.createComponent(Box, {
inlineSize: 80,
blockSize: 80,
});
const image = root.createComponent(Image, {
source: 'https://cdn.shopify.com/s/files/placeholder-images/product.png',
accessibilityLabel: 'Product thumbnail',
});
imageBox.appendChild(image);
const detailBox = root.createComponent(Box);
const title = root.createComponent(Text, {fontWeight: 'bold'}, 'Premium Widget');
const sku = root.createComponent(Text, {}, 'SKU: WH-1234');
const price = root.createComponent(Text, {}, '$49.99');
detailBox.appendChild(title);
detailBox.appendChild(sku);
detailBox.appendChild(price);
row.appendChild(imageBox);
row.appendChild(detailBox);
stack.appendChild(row);
root.appendChild(stack);
},
);Anchor to Control visibility with displayControl visibility with display
Hide supplementary content from the visible layout while keeping it in the DOM. This example uses display="none" on a Box with accessibilityRole="status" to remove a compliance message visually without deleting it from the page.
Control visibility with display
React
import {reactExtension, Box, Text, BlockStack} from '@shopify/ui-extensions-react/admin';
function App() {
return (
<BlockStack gap>
<Text fontWeight="bold">Compliance status</Text>
<Box display="auto" padding="base">
<Text>This product has been reviewed and approved for sale.</Text>
</Box>
<Box display="none" accessibilityRole="status">
<Text>Compliance check passed — accessible to screen readers only.</Text>
</Box>
</BlockStack>
);
}
export default reactExtension(
'admin.product-details.block.render',
() => <App />,
);TS
import {extension, Box, Text, BlockStack} from '@shopify/ui-extensions/admin';
export default extension(
'admin.product-details.block.render',
(root) => {
const stack = root.createComponent(BlockStack, {gap: true});
const heading = root.createComponent(Text, {fontWeight: 'bold'}, 'Compliance status');
const visibleBox = root.createComponent(Box, {
display: 'auto',
padding: 'base',
});
const visibleText = root.createComponent(Text, {}, 'This product has been reviewed and approved for sale.');
visibleBox.appendChild(visibleText);
const hiddenBox = root.createComponent(Box, {
display: 'none',
accessibilityRole: 'status',
});
const hiddenText = root.createComponent(
Text,
{},
'Compliance check passed — accessible to screen readers only.',
);
hiddenBox.appendChild(hiddenText);
stack.appendChild(heading);
stack.appendChild(visibleBox);
stack.appendChild(hiddenBox);
root.appendChild(stack);
},
);Anchor to Best practicesBest practices
- Use Box for padding and sizing control: Box is most useful when you need to add padding around content or control the block and inline size of a container without the stacking behavior of BlockStack or InlineStack.
- Prefer BlockStack and InlineStack for stacking: If you are arranging multiple children vertically or horizontally, use BlockStack or InlineStack instead of Box. Those components provide gap control and alignment that Box doesn't.
Anchor to LimitationsLimitations
- Box doesn't support gap or spacing between children. To add spacing between child elements, use BlockStack or InlineStack instead.
- Box doesn't render any visible background, border, or shadow. It's a transparent layout wrapper. There is no built-in way to create card-like visual containers with Box alone.
- Box doesn't support flex direction, wrapping, or alignment props. It's not a flex container. For flex-like layouts, use BlockStack or InlineStack.