Scroll Area
A vertical or horizontal scrolling container that tells you when the user reaches either end.
Installation
Usage
src/app/app.ts
- Give it a height. A Lynx scroll view scrolls only inside a fixed height. Set
height, or pass a height class such asclass="h-64"orclass="flex-1". - Children sit in an inner column, or a row when horizontal. Style it with
contentClass, for example for gaps and padding. - CSS overflow doesn't scroll on Lynx, which is why this wraps a
<scroll-view>element. - For long lists of similar rows, use List, which reuses rows as they scroll off screen.
Horizontal
The scroll area fills its parent's width in both orientations (w-full).
Reaching an end
scrolledToEnd fires within lowerThreshold pixels of the bottom (or right) edge, and scrolledToStart within upperThreshold of the top (or left). A threshold lets you load more before the user hits the end.
Bounce and scroll bar
bounces and scrollBar are on by default. Turn either off with false:
Lynx documents both attributes of <scroll-view> for iOS only.
API
UiScrollArea
Related
<scroll-view>: the element underneath, with more attributes and events- List: a recycling list for long data
- Elements and layout
