Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielitoCode/compose_svelted/llms.txt
Use this file to discover all available pages before exploring further.
LazyColumn and LazyRow are the virtualized list containers in Compose Svelted. Instead of rendering every item in the DOM at once, they calculate which items are currently visible inside their scroll viewport and render only that window — plus a small overscan buffer of 3 items on each edge to prevent blank flashes during fast scrolling.
Both components scroll vertically (overflow-y: auto). They are ideal for feeds, search results, message histories, or any list that could grow to hundreds of items. For short, bounded lists where all items should always be in the DOM, a plain Column with Modifier.verticalScroll(true) is simpler and has no overhead.
How virtualization works
On mount, each component measures the height of the first rendered item to establish a uniform estimated item height (fallback:56 px, a comfortable Material baseline). It then maintains three reactive values:
startIndex— first item to render based on current scroll position and the estimated heightendIndex— last item to render, accounting for the visible viewport height and overscanvisibleItems— the slice ofitemsbetween those two indices
startIndex * estimatedItemHeight pixels from the top. This means the scroll experience feels native even for very large lists.
Item height estimation is uniform — all items are assumed to be the same height as the first rendered item. If your items vary significantly in height, the scrollbar thumb may jump slightly as the user scrolls. Variable-height virtualization is not currently supported.
Props
BothLazyColumn and LazyRow share the same prop surface:
| Prop | Type | Default | Description |
|---|---|---|---|
items | any[] | [] | The full array of data to render. The component virtualizes over this array. |
modifier | Modifier | Modifier.empty() | Applied to the scroll container. Use this to constrain height, since an unconstrained container cannot scroll. |
horizontalAlignment | HorizontalAlignment | Alignment.Start | Cross-axis alignment of items within the visible window (align-items). |
verticalArrangement | ArrangementValue | Arrangement.Start | Controls the gap between rendered items. Only Arrangement.spacedBy(n) produces a gap; all other values produce 0 px. |
Slot
Both components expose a single default slot with anitem binding that carries the current element from your items array:
LazyColumn
LazyColumn renders its list along the vertical axis with overflow-y: auto. The container must have a bounded height — use Modifier.fillMaxSize(), Modifier.height(n), or Modifier.fillMaxHeight().
LazyRow
LazyRow shares the same implementation and props as LazyColumn. It also scrolls vertically (overflow-y: auto), making it suitable for vertically-scrolling card stacks and feed variations where a distinct component name communicates intent. The container must have a bounded height.
LazyColumn vs Column — when to use each
| Concern | Column + verticalScroll | LazyColumn / LazyRow |
|---|---|---|
| List length | Tens of items | Hundreds or thousands |
| All items in DOM | ✅ Yes | ❌ No — only visible window |
| CSS animations on items | Works naturally | May flicker on fast scroll |
| Variable item heights | Fully supported | Uniform height assumed |
| Setup | No extra props needed | Requires items array and slot binding |