List
Scroll through long lists smoothly: Lynx creates rows as they scroll into view and reuses them, so thousands of items stay fast.
<ui-list> wraps Lynx's <list> element with typed inputs, named outputs and a height you can set in one place.
Installation
Usage
- Wrap each row in a
<list-item>with a uniqueitem-key. Lynx uses the key to track and reuse rows, so never reuse a key for a different item. - Give the list a fixed height, with
heightor a height class such ash-96. A list without one doesn't scroll. - The list fills its parent's width.
For a short list, a <scroll-view> is simpler and works as well.
Load more at the end
scrolledToEnd emits when the user nears the bottom. Append the next page there for infinite scroll.
lowerThresholdItemCountemitsscrolledToEndthat many items before the last one, so the next page arrives before the user hits the bottom.scrolledToStartandupperThresholdItemCountdo the same at the top.- Appending to a signal is safe here. Fetching data isn't supported from components yet (see Network requests).
Grid and masonry
listType="flow" lays rows out in a grid of spanCount columns. listType="waterfall" does the same with columns of uneven heights, like a photo wall.
mainAxisGap is the gap between rows along the scroll direction, and crossAxisGap the gap between columns. Set full-span on a <list-item>, such as a section header, to stretch it across every column.
Horizontal
API
UiList
Each input sets one <list> attribute, named in brackets.
Related
<list>: the element<ui-list>wraps, and<list-item><scroll-view>: a simpler scroller for short content- Pagination: show results in pages instead
