Box
This is your foundational structural element for composing UI. It can be styled using predefined tokens. Use it to build your layout.
Anchor to boxpropsBoxProps
- Anchor to accessibilityRoleaccessibilityRoleAccessibilityRoleDefault: 'generic'
Sets 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 blockSizeblockSizenumber | `${number}%`
Adjust the block size.
number
: size in pixels.`${number}%`
: size in percentages of the available space.
- Anchor to displaydisplay'auto' | 'none'Default: 'auto'
The display property sets the display behavior of an element.
- Anchor to inlineSizeinlineSizenumber | `${number}%`
Adjust the inline size.
number
: size in pixels.`${number}%`
: size in percentages of the available space.
- Anchor to maxBlockSizemaxBlockSizenumber | `${number}%`
Adjust the maximum block size.
number
: size in pixels.`${number}%`
: size in percentages of the available space.
- Anchor to maxInlineSizemaxInlineSizenumber | `${number}%`
Adjust the maximum inline size.
number
: size in pixels.`${number}%`
: size in percentages of the available space.
- Anchor to minBlockSizeminBlockSizenumber | `${number}%`
Adjust the minimum block size.
number
: size in pixels.`${number}%`
: size in percentages of the available space.
- Anchor to minInlineSizeminInlineSizenumber | `${number}%`
Adjust the minimum inline size.
number
: size in pixels.`${number}%`
: size in percentages of the available space.
- Anchor to paddingpaddingMaybeAllBoxEdgesShorthandProperty<SpacingKeyword | boolean>
Adjust the padding.
To shorten the code, it is possible to specify all the padding for all edges of the box in one property.
base
means block-start, inline-end, block-end and inline-start paddings arebase
.base none
means block-start and block-end paddings arebase
, inline-start and inline-end paddings arenone
.base none large
means block-start padding isbase
, inline-end padding isnone
, block-end padding islarge
and inline-start padding isnone
.base none large small
means block-start padding isbase
, inline-end padding isnone
, block-end padding islarge
and inline-start padding issmall
.true
applies a default padding that is appropriate for the component.
Learn more about the 1-to-4-value syntax at https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box
- Anchor to paddingBlockpaddingBlockMaybeTwoBoxEdgesShorthandProperty<SpacingKeyword | boolean>
Adjust the block-padding.
base none
means block-start padding isbase
, block-end padding isnone
.
- Anchor to paddingBlockEndpaddingBlockEndSpacingKeyword | boolean
Adjust the block-end padding.
- Anchor to paddingBlockStartpaddingBlockStartSpacingKeyword | boolean
Adjust the block-start padding.
- Anchor to paddingInlinepaddingInlineMaybeTwoBoxEdgesShorthandProperty<SpacingKeyword | boolean>
Adjust the inline padding.
base none
means inline-start padding isbase
, inline-end padding isnone
.
- Anchor to paddingInlineEndpaddingInlineEndSpacingKeyword | boolean
Adjust the inline-end padding.
- Anchor to paddingInlineStartpaddingInlineStartSpacingKeyword | boolean
Adjust the inline-start padding.
AccessibilityRole
'main' | 'header' | 'footer' | 'section' | 'aside' | 'navigation' | 'ordered-list' | 'list-item' | 'list-item-separator' | 'unordered-list' | 'separator' | 'status' | 'alert' | 'generic'
MaybeAllBoxEdgesShorthandProperty
T | `${T} ${T}` | `${T} ${T} ${T}` | `${T} ${T} ${T} ${T}`
SpacingKeyword
'none' | 'small' | 'base' | 'large'
MaybeTwoBoxEdgesShorthandProperty
T | `${T} ${T}`
Use Box to build your layout
Examples
Use Box to build your layout
React
import {render, Box} from '@shopify/ui-extensions-react/admin'; render('Playground', () => <App />); function App() { return ( <Box padding="base"> Box </Box> ); }
JS
import {extend, Box} from '@shopify/ui-extensions/admin'; extend('Playground', (root) => { const box = root.createComponent( Box, {padding: 'base'}, 'Box', ); root.appendChild(box); });
Preview
