--- 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 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. 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 --- # 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. ## 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 Deprecated horizontal spacing values using named size keywords. ```ts 'HalfPoint' | 'ExtraSmall' | 'Small' | 'Medium' | 'Large' | 'ExtraLarge' | 'ExtraExtraLarge' ``` ### VerticalSpacing Deprecated vertical spacing values using named size keywords. ```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 ##### Description 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. ##### 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', () => (