--- title: Stack description: >- The Stack component organizes elements horizontally or vertically along the block or inline axis. Use it to structure layouts, group related components, or control spacing between elements with api_version: 2025-07 api_name: pos-ui-extensions source_url: html: >- https://shopify.dev/docs/api/pos-ui-extensions/2025-07/ui-components/layout-and-structure/stack md: >- https://shopify.dev/docs/api/pos-ui-extensions/2025-07/ui-components/layout-and-structure/stack.md --- Migrate to Polaris Version 2025-07 is the last API version to support React-based UI components. Later versions use [web components](https://shopify.dev/docs/api/pos-ui-extensions/latest/web-components), native UI elements with built-in accessibility, better performance, and consistent styling with [Shopify's design system](https://shopify.dev/docs/apps/design). Check out the [migration guide](https://shopify.dev/docs/apps/build/pos/upgrading-to-2025-10) to upgrade your extension. # Stack The Stack component organizes elements horizontally or vertically along the block or inline axis. Use it to structure layouts, group related components, or control spacing between elements with flexible alignment options. The component simplifies layout creation by automatically managing spacing between child elements through gap properties, eliminating the need for manual margin management. It supports both horizontal and vertical arrangements, flexible alignment options, and wrapping behavior, making it the foundation for building consistent, responsive layouts throughout POS extensions. Stack components support responsive gap values that automatically adjust spacing based on screen size, ensuring layouts remain visually balanced and maintain proper element separation across different devices. ### Support Targets (16) ### Supported targets * [pos.​cart.​line-item-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/cart-details#cart-details-action-modal-) * [pos.​customer-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/customer-details#customer-details-action-modal-) * [pos.​customer-details.​block.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/customer-details#customer-details-targets) * [pos.​draft-order-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/draft-order-details#draft-order-details-action-modal-) * [pos.​draft-order-details.​block.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/draft-order-details#draft-order-details-targets) * [pos.​exchange.​post.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/post-exchange#post-exchange-action-modal-) * [pos.​exchange.​post.​block.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/post-exchange#post-exchange-targets) * [pos.​home.​modal.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/home-screen#home-screen-action-modal-) * [pos.​order-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/order-details#order-details-action-modal-) * [pos.​order-details.​block.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/order-details#order-details-targets) * [pos.​product-details.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/product-details#product-details-action-modal-) * [pos.​product-details.​block.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/product-details#product-details-targets) * [pos.​purchase.​post.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/post-purchase#post-purchase-action-modal-) * [pos.​purchase.​post.​block.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/post-purchase#post-purchase-targets) * [pos.​return.​post.​action.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/post-return#post-return-action-modal-) * [pos.​return.​post.​block.​render](https://shopify.dev/docs/api/pos-ui-extensions/2025-07/targets/post-return#post-return-targets) #### Use cases * **Organized layouts:** Arrange form elements, buttons, or content in organized layouts. * **Responsive design:** Create responsive layouts that adapt to different screen sizes. * **Consistent spacing:** Control spacing between elements for visual hierarchy. * **Precise alignment:** Align content precisely using justify and align properties. *** ## Properties Configure the following properties on the Stack component. * **alignContent** **'stretch' | ContentPosition | ContentDistribution** **Default: 'start'** The alignment of the Stack component along the cross axis, controlling how content is distributed when there's extra space. Learn more about [align-content on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content). * **alignItems** **'stretch' | 'baseline' | ContentPosition** **Default: 'stretch'** The alignment of the Stack component's children along the cross axis, controlling how individual items are positioned. Learn more about [align-items on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items). * **blockSize** **SizeUnitsOrAuto** **Default: 'auto'** Adjusts the block size (height in horizontal writing modes). Use `'auto'` to take the block size of the box's children. Learn more about [block-size on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/block-size). * **columnGap** **SpacingKeyword | ''** **Default: '' - meaning no override** The spacing between elements in the inline axis. Overrides the column value of gap. * **direction** **'inline' | 'block' | DeprecatedStackDirection** **Default: 'inline'** The direction in which children are placed within the Stack component. Use `'block'` for vertical arrangement along the block axis without wrapping, or `'inline'` for horizontal arrangement along the inline axis with automatic wrapping. * **flex** **number** The flex value for the Stack component. A value of 1 will stretch the component to fill the parent container. * **flexChildren** **boolean** A boolean that determines whether the children should be stretched to fill the cross axis. * **gap** **SpacingKeyword** **Default: '0'** The size of the gap between each child in the Stack component. * **inlineSize** **SizeUnitsOrAuto** **Default: 'auto'** Adjusts the inline size (width in horizontal writing modes). Use `'auto'` to take the inline size of the box's children. Learn more about [inline-size on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/inline-size). * **justifyContent** **ContentPosition | ContentDistribution** **Default: 'start'** The alignment of the Stack component along the main axis, controlling how space is distributed between and around content items. Learn more about [justify-content on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content). * **maxBlockSize** **SizeUnitsOrNone** **Default: 'none'** Adjusts the maximum block size (max-height in horizontal writing modes). Learn more about [max-block-size on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/max-block-size). * **maxInlineSize** **SizeUnitsOrNone** **Default: 'none'** Adjusts the maximum inline size (max-width in horizontal writing modes). Learn more about [max-inline-size on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/max-inline-size). * **minBlockSize** **SizeUnits** **Default: '0'** Adjusts the minimum block size (min-height in horizontal writing modes). Learn more about [min-block-size on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/min-block-size). * **minInlineSize** **SizeUnits** **Default: '0'** Adjusts the minimum inline size (min-width in horizontal writing modes). Learn more about [min-inline-size on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/min-inline-size). * **padding** **PaddingKeys** **Default: '0'** Adjusts the padding on all edges of the box using predefined spacing values. * **paddingBlock** **PaddingKeys** **Default: '0'** Adjusts the padding on the block axis (vertical in horizontal writing modes). Overrides the block value from `padding`. * **paddingBlockEnd** **PaddingKeys** **Default: '0'** Adjusts the padding at the block-end edge (bottom in horizontal writing modes). Overrides the end value from `paddingBlock`. * **paddingBlockStart** **PaddingKeys** **Default: '0'** Adjusts the padding at the block-start edge (top in horizontal writing modes). Overrides the start value from `paddingBlock`. * **paddingInline** **PaddingKeys** **Default: '0'** Adjusts the padding on the inline axis (horizontal in horizontal writing modes). Overrides the inline value from `padding`. * **paddingInlineEnd** **PaddingKeys** **Default: '0'** Adjusts the padding at the inline-end edge (right in left-to-right languages). Overrides the end value from `paddingInline`. * **paddingInlineStart** **PaddingKeys** **Default: '0'** Adjusts the padding at the inline-start edge (left in left-to-right languages). Overrides the start value from `paddingInline`. * **rowGap** **SpacingKeyword | ''** **Default: '' - meaning no override** The spacing between elements in the block axis. Overrides the row value of gap. * **alignment** **ContentPosition | ContentDistribution** **Default: 'flex-start'** **deprecated** The alignment of the children along the main axis. **Deprecated:** Use the `justifyContent` prop instead. * **flexWrap** **'wrap' | 'nowrap' | 'wrap-reverse'** **deprecated** The wrap behavior for the children of the Stack component. **Deprecated:** This property has no effect as content will always wrap. * **paddingHorizontal** **HorizontalSpacing** **deprecated** The horizontal padding around the Stack component. **Deprecated:** Use the `paddingInline` prop instead. * **paddingVertical** **VerticalSpacing** **deprecated** The vertical padding around the Stack component. **Deprecated:** Use the `paddingBlock` prop instead. * **spacing** **Spacing** **Default: 1** **deprecated** The spacing between each child in the Stack component. **Deprecated:** Use the `gap` prop instead. ### ContentPosition Defines positioning values for aligning content within a container. ```ts 'center' | 'start' | 'end' ``` ### ContentDistribution Defines distribution strategies for spacing content within a container. ```ts 'space-around' | 'space-between' | 'space-evenly' ``` ### SizeUnitsOrAuto Extends SizeUnits to include \`'auto'\` for properties that can automatically size based on content. ```ts SizeUnits | 'auto' ``` ### SizeUnits Defines CSS size units for dimensions, supporting pixel values, percentages, or zero. ```ts `${number}px` | `${number}%` | `0` ``` ### SpacingKeyword Spacing values that can be used for gaps between elements, including all size keywords and \`'none'\` for no spacing. ```ts SizeKeyword | 'none' ``` ### SizeKeyword Defines the standardized spacing scale used throughout the POS design system. Each keyword maps to a predetermined spacing value that ensures visual consistency across components. Values range from \`'0'\` (no spacing) through \`'2000'\` (maximum spacing), with increments designed to create harmonious visual rhythm and hierarchy. ```ts '0' | '025' | '050' | '100' | '200' | '250' | '300' | '350' | '400' | '450' | '500' | '600' | '700' | '800' | '900' | '1000' | '1100' | '1200' | '1400' | '1800' | '2000' ``` ### DeprecatedStackDirection ```ts 'vertical' | 'horizontal' ``` ### SizeUnitsOrNone Extends SizeUnits to include \`'none'\` for properties that can be explicitly disabled. ```ts SizeUnits | 'none' ``` ### PaddingKeys Defines the allowed padding values, including all standardized size keywords and \`'none'\` for no padding. ```ts SizeKeyword | 'none' ``` ### HorizontalSpacing The spacing values for controlling horizontal space between elements. ```ts 'HalfPoint' | 'ExtraSmall' | 'Small' | 'Medium' | 'Large' | 'ExtraLarge' | 'ExtraExtraLarge' ``` ### VerticalSpacing The spacing values for controlling vertical space between elements. ```ts 'HalfPoint' | 'ExtraSmall' | 'Small' | 'Medium' | 'Large' | 'ExtraLarge' ``` ### Spacing Deprecated spacing values represented as numeric multipliers. ```ts 0.5 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 16 ``` *** ## Examples ### Layout elements horizontally or vertically Organize UI elements horizontally or vertically with automatic spacing management. This example shows a Stack with default values, demonstrating how to structure layouts and control element spacing through gap properties without manual margin management. ## Layout elements horizontally or vertically ![Organize UI elements horizontally or vertically with automatic spacing management. This example shows a Stack with default values, demonstrating how to structure layouts and control element spacing through gap properties without manual margin management.](https://shopify.dev/assets/assets/images/templated-apis-screenshots/pos-ui-extensions/2025-07/stack-default-BuzNUeVT.png) ## Layout elements horizontally or vertically ##### React ```tsx import { reactExtension, Button, Stack, Screen, } from '@shopify/ui-extensions-react/point-of-sale'; import React from 'react'; export default reactExtension('pos.home.modal.render', () => (