Skip to main content
Migrate to Polaris

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.

BlockLayout

The BlockLayout component arranges content over multiple rows with explicit control over row sizing. Use BlockLayout to create vertical layouts where each row can have a different proportion, such as a fixed header row with an expandable content area below.

BlockLayout supports flexible row configurations and gap spacing for precise vertical layout control. For simpler vertical stacking with uniform spacing, use BlockStack. For horizontal column layouts, use InlineLayout.

Support
Targets (25)

Configure the following properties on the BlockLayout component.

Anchor to accessibilityLabel
accessibilityLabel
string

A label announced by assistive technologies that describes the purpose or contents of the element. Only set this when the element's visible content doesn't provide enough context on its own.

Anchor to accessibilityRole
accessibilityRole

The semantic meaning of the component's content. When set, assistive technologies use this role to help users navigate the page. Accepts a single role or a tuple of two roles (for example, ['listItem', 'separator']).

Anchor to background
background
<>
Default: 'transparent'

The background color of the element, set using a design-system keyword.

Anchor to blockAlignment
blockAlignment
<>

The alignment of children along the block (cross) axis.

Anchor to border
border
<<>>

The border style of the element. Accepts a single value for all four edges, or a shorthand tuple for per-edge control:

  • 'base': Applies base to all edges.
  • ['base', 'none']: Block edges get base, inline edges get none.
  • ['base', 'none', 'dotted', 'base']: Values apply to block-start, inline-end, block-end, and inline-start respectively.
Anchor to borderWidth
borderWidth
< <> >

The border width of the element. Accepts a single value for all four edges, or a shorthand tuple for per-edge control:

  • 'base': Applies base to all edges.
  • ['base', 'medium']: Block edges get base, inline edges get medium.
  • ['base', 'medium', 'medium', 'base']: Values apply to block-start, inline-end, block-end, and inline-start respectively.
Anchor to cornerRadius
cornerRadius
< <> >

The corner radius of the element. Accepts a single value for all four corners, or a shorthand tuple for per-corner control using logical (writing-mode-aware) corners:

  • 'base': All four corners get base radius.
  • ['base', 'none']: StartStart/EndEnd get base, StartEnd/EndStart get none. In left-to-right mode, StartStart and EndEnd are the top-left and bottom-right corners.
  • ['base', 'none', 'small', 'base']: Values apply to StartStart, StartEnd, EndEnd, and EndStart respectively.

A borderRadius alias is available. When both are set, cornerRadius takes precedence.

Anchor to display
display
<'auto' | 'none'>
Default: 'auto'

The display mode of the component. Learn more about display.

  • auto: The initial value; the actual behavior depends on the component and context.
  • none: Hides the component and removes it from the accessibility tree.
string

A unique identifier for the component. Use this to target the component in scripts or stylesheets, or to distinguish it from other instances of the same component.

Anchor to inlineAlignment
inlineAlignment
<>

The alignment of children along the inline (main) axis.

Anchor to maxBlockSize
maxBlockSize
< number | `${number}%` | 'fill' >

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.
  • 'fill': Takes all the available space.

Learn more about the max-block-size property.

Anchor to maxInlineSize
maxInlineSize
< number | `${number}%` | 'fill' >

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.
  • 'fill': Takes all the available space.

Learn more about the max-inline-size property.

Anchor to minBlockSize
minBlockSize
< number | `${number}%` | 'fill' >

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.
  • 'fill': Takes all the available space.

Learn more about the min-block-size property.

Anchor to minInlineSize
minInlineSize
< number | `${number}%` | 'fill' >

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.
  • 'fill': Takes all the available space.

Learn more about the min-inline-size property.

Anchor to overflow
overflow
'hidden' | 'visible'
Default: 'visible'

The overflow behavior of the element.

  • visible: Content that extends beyond the container is visible.
  • hidden: Content that extends beyond the container is clipped and not scrollable.
Anchor to padding
padding
<<>>

The padding on all edges of the element, using a shorthand syntax. You can specify one, two, or four values following the CSS shorthand convention.

  • T: A single value applied uniformly to all edges.
  • [T, T]: The first value applies to block-start and block-end, the second to inline-start and inline-end.
  • [T, T, T, T]: Values apply to block-start, inline-end, block-end, and inline-start respectively.
<>
Default: 'fill'

The sizes for each row of the layout.

  • auto: The intrinsic size of the element.
  • fill: Fills the remaining available space. When multiple elements use fill, the space is shared equally.
  • `${number}%`: A percentage of the container's block size.
  • `${number}fr`: A fractional unit of the available space.
  • number: A fixed size in pixels.

When the sum of defined sizes exceeds the available space, elements shrink to avoid overflow. Elements without an explicit size fill the remaining space. A single value outside an array applies to all rows.

Anchor to spacing
spacing
< | [, ]>
Default: 'none'

The spacing between child elements. A single value applies to both the row and column axes. A pair of values (for example, ['base', 'none']) sets the row and column spacing independently.

Anchor to borderRadius
borderRadius
< <> >

The corner radius of the element. Accepts a single value for all four corners, or a shorthand tuple for per-corner control:

  • 'base': All four corners get base radius.
  • ['base', 'none']: StartStart/EndEnd get base, StartEnd/EndStart get none.
  • ['base', 'none', 'small', 'base']: Values apply to StartStart, StartEnd, EndEnd, and EndStart respectively.
Deprecated

Use cornerRadius instead.


Anchor to Lay out content in rowsLay out content in rows

Use BlockLayout to arrange content in multiple rows. This example shows the default behavior where rows share the available block space equally.

Lay out content in rows

A BlockLayout component arranging content in multiple rows.

Lay out content in rows

import {
reactExtension,
BlockLayout,
View,
} from '@shopify/ui-extensions-react/customer-account';

export default reactExtension(
'customer-account.page.render',
() => <Extension />,
);

function Extension() {
return (
<BlockLayout rows={[60, 'fill']}>
<View border="base" padding="base">
60
</View>
<View border="base" padding="base">
fill
</View>
</BlockLayout>
);
}
import {extension, BlockLayout, View} from '@shopify/ui-extensions/customer-account';

export default extension('customer-account.page.render', (root) => {
const blockLayout = root.createComponent(
BlockLayout,
{
rows: [60, 'fill'],
},
[
root.createComponent(View, {border: 'base', padding: 'base'}, '60'),
root.createComponent(View, {border: 'base', padding: 'base'}, 'fill'),
],
);

root.appendChild(blockLayout);
});

  • Use explicit row sizes for unequal layouts: Set the rows prop with specific sizes when rows should have different proportions. Default equal distribution works well for balanced layouts.
  • Choose BlockLayout over BlockStack for row control: Use BlockLayout when you need to define explicit row sizes. For uniform vertical spacing between elements, BlockStack is simpler.
  • Combine with StyleHelper for responsiveness: Use StyleHelper to adjust row sizes at different viewport breakpoints.

  • BlockLayout fills the available block space by default. Children can't exceed the container height without setting overflow.
  • Row sizes are defined as a flat array. You can't assign sizes to specific rows by name.
  • BlockLayout doesn't support column-based layouts. Use InlineLayout or Grid for columns.

Was this page helpful?