Use to lay out a horizontal row of components or to achieve no-fuss vertical centering.
A stack is made of flexible items that wrap each of the stack’s children. Options provide control of the wrapping, spacing, and relative size of the items in the stack.
StackItem to group multiple elements inside a
optional = ?
||Stack the elements vertically. Defaults to Horizontal|
||Defines how elements are arranged along the axis|
||Alignment of element perpendicular to the axis. Default value:
||Spacing between elements|
||Wrap elements to additional rows as needed on small screens. Default value|
- 📱 All children of Stack are placed in a single view object, which makes recycling the views expensive and results in poorer performance when scrolling. Consider keeping your Stacks simple.
- By default, Stacks alignment is
- Distribution is ignored for vertical stacks
|✅ Do||🛑 Don't|
|📱 Keep Stacks narrow. There is typically more vertical space than horizontal||📱 Use complex and deep Stack layouts|
|📱 Keep Horizontal Stacks shallow. Complex hierarchies have performance penalties|
For more guidelines, refer to Polaris' Stack best practices.