--- 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: 2024-07 api_name: pos-ui-extensions source_url: html: >- https://shopify.dev/docs/api/pos-ui-extensions/2024-07/ui-components/layout-and-structure/stack md: >- https://shopify.dev/docs/api/pos-ui-extensions/2024-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. * direction 'vertical' | 'horizontal' required The direction of the stack. * alignment \| 'flex-end' | 'center' | 'flex-start' | 'space-around' | 'space-between' | 'space-evenly' Default: 'flex-end' The alignment of the children along the cross axis. * flex number The flex value for the stack. * flexChildren boolean Whether the children should be stretched to fill the cross axis. * flexWrap 'wrap' | 'nowrap' | 'wrap-reverse' Wrap behavior for the children of the stack. * paddingHorizontal HorizontalSpacing The horizontal padding around the stack. * paddingVertical VerticalSpacing The vertical padding around the stack. * spacing Spacing Default: 1 The spacing between each child in the stack. ### HorizontalSpacing ```ts 'HalfPoint' | 'ExtraSmall' | 'Small' | 'Medium' | 'Large' | 'ExtraLarge' | 'ExtraExtraLarge' ``` ### VerticalSpacing ```ts 'HalfPoint' | 'ExtraSmall' | 'Small' | 'Medium' | 'Large' | 'ExtraLarge' ``` ### Spacing ```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