The LazyVStack
component is part of the Scripting app's UI library. It arranges its children in a vertical stack, creating and displaying items only as needed, optimizing performance for large data sets.
FunctionComponent<LazyVStackProps>
A LazyVStack
arranges its children in a line that grows vertically. Unlike a regular vertical stack, it lazily loads and displays views only when they are about to appear on the screen. This makes it ideal for lists or large sets of dynamically generated content.
Property | Type | Default | Description |
---|---|---|---|
alignment |
HorizontalAlignment |
undefined |
Determines how the children are aligned horizontally within the stack. All child views share the same horizontal screen coordinate. |
spacing |
number |
undefined (default spacing) |
The space between adjacent subviews. If undefined , the stack uses a default spacing value. |
pinnedViews |
'sectionHeaders' | 'sectionFooters' | 'sectionHeadersAndFooters' |
undefined |
Specifies which child views remain pinned to the bounds of the scroll view during scrolling. |
children |
(VirtualNode | undefined | null | (VirtualNode | undefined | null)[])[] | VirtualNode |
undefined |
The content to be displayed in the stack. Accepts one or multiple VirtualNode elements, including arrays and optional null or undefined values. |
The PinnedScrollViews
type defines which kinds of child views can remain pinned to the scroll view's bounds as it scrolls:
'sectionHeaders'
: Pins only the section headers'sectionFooters'
: Pins only the section footers'sectionHeadersAndFooters'
: Pins both section headers and footersSection
views vertically with 12
points of spacingalignment
property aligns the items to the leading edge of the stackpinnedViews
property ensures that section headers remain pinned to the top of the scroll view when scrollingspacing
to control the vertical distance between items and alignment
to customize the horizontal alignmentpinnedViews
property is especially useful for table or list-like layouts with sticky headers or footersThis API allows you to efficiently manage vertically growing content while offering customization for layout and scrolling behavior.