Skip to main content
ScrollView is the generic scrollable container — wrap any content that may exceed the available space, on either axis. List is the iOS-native scrollable list with row chrome, separators, and optional selection tracking. ForEach iterates over data to produce one child per item, and is what you typically pair with the lazy stacks inside a ScrollView or with sections inside a List.

ScrollView

A scrollable container for content that may exceed the available space.
children
Component | Component[]
required
The scrollable content. Typically a stack or lazy stack containing the scroll content.
props
object
Configuration options for the scroll view.
Vertical scrolling
Horizontal scrolling
With a lazy stack For large data sets, use LazyVStack or LazyHStack inside a ScrollView for efficient rendering:
Hiding scroll indicators

List

A scrollable list with optional selection tracking.
children
Component[]
required
The list content. Typically contains ForEach or Section components.
props
object
Configuration options for selection tracking.
Basic list
With ForEach
With sections
With selection tracking
List provides built-in scrolling — you don’t need to wrap it in a ScrollView. For selection tracking, each row should have a .tag() modifier so the list can identify which item is selected. Customize with .listStyle(), .listRowBackground(), and .listRowSeparator(). For a non-list scrollable layout, use ScrollView with LazyVStack.

ForEach

Iterates over data to produce components, creating one child per item.
data
T[]
required
An array of items to iterate over. Each item is passed to the content function.
content
(item: T, index: number) => Component
required
A function that returns a component for each item. Receives the item and its index.
subviews
Component
required
Subviews overload: a component whose children are decomposed into individual subviews for rearranging or inspection.
content
({ subview: T }) => Component
required
Subviews overload: a function that receives each subview and returns a component.
Basic iteration
Using the index
Inside a layout container
Subview decomposition Use the subviews overload to inspect and rearrange children of an existing component:
Each call to the content function should return exactly one component. Use Group to return multiple components as one. The index parameter is zero-based. The subviews overload enables view decomposition patterns, letting you restructure existing component trees without rebuilding them.

See also

  • LazyVStack — lazy vertical stack for long scrollable lists
  • LazyHStack — lazy horizontal stack for carousels
  • Section — grouping with headers and footers in a List
  • Group — return multiple components as one
  • Axis — scroll direction values