The VStack
component in the Scripting app is a layout view that arranges its child views vertically. It provides flexible options for aligning its subviews and controlling the spacing between them.
VStack
ComponentThe VStack
component arranges its child views in a vertical line, making it ideal for creating vertically stacked layouts. You can customize the alignment of subviews and the spacing between them to suit your design needs.
alignment
(Optional)HorizontalAlignment
"center"
VStack
."leading"
: Aligns views to the left."center"
: Centers views horizontally."trailing"
: Aligns views to the right.spacing
(Optional)number | undefined
undefined
to let the stack automatically determine the optimal spacing.children
(Optional)undefined
/null
values. Nullish values are ignored, allowing for dynamic layouts.HorizontalAlignment
TypeHorizontal alignment guides control how views are positioned relative to each other when placed vertically in a VStack
.
leading
: Aligns all subviews to the left edge of the stack.center
: Centers all subviews horizontally.trailing
: Aligns all subviews to the right edge of the stack.Below is an illustration of the three alignment options:
alignment="leading"
: Aligns all subviews to the left.spacing={10}
: Adds 10 pixels of space between each subview.Image
view displaying a system icon.Text
views displaying labeled items.alignment
to control horizontal positioning when stacking text and icons for better visual consistency.spacing
to create breathable and aesthetically pleasing layouts.null
or undefined
values.This documentation ensures you can confidently use the VStack
component to create clean, vertically stacked layouts in your Scripting app projects.