Documentation
Infinite Scroll
SimpleTable provides built-in infinite scroll functionality that automatically loads more data as users scroll near the bottom of the table. This feature is perfect for handling large datasets without overwhelming the user or degrading performance.
Basic Usage
To enable infinite scroll in your table, follow these steps:
- Set a fixed height - Use the
heightprop to create a scrollable container - Implement the callback - Create an
onLoadMorefunction that fetches additional data - Update state - Append new data to your existing rows array
Infinite Scroll Configuration
How It Works
SimpleTable's infinite scroll implementation:
- Scroll Detection - Monitors scroll position within the table container
- Threshold Triggering - Calls
onLoadMorewhen user scrolls withininfiniteScrollThresholdpixels of the bottom (default 200px) - Debouncing - Prevents multiple simultaneous requests by debouncing the scroll event
- Smooth Integration - New data is seamlessly appended to the existing table
Window / External Scroll Mode
Want the table to behave like a regular page section — growing to its natural height while the page (or a parent container) scrolls? Drop height / maxHeight and pass scrollParent. The table will:
- Virtualize against the parent - Only the rows visible inside the parent's viewport are rendered, even with tens of thousands of rows.
- Fire onLoadMore from the parent's scroll - The threshold check uses the parent's position relative to the table, not the table's own (non-existent) inner scroll.
- Pin the header automatically - The header sticks to the top of the parent's scroll viewport via CSS
position: stickyso it stays visible as users scroll through the rows. - Suppress overscroll bounce - Sets
overscroll-behavior-y: noneon the scroll parent so the rubber-band effect doesn't visually shift the sticky header off the viewport. Restored on unmount.
Window / External Scroll Props
Precedence rules
heightormaxHeightalways win. If either is set,scrollParentis ignored and the table uses its own inner scroll.- Without
scrollParentand withoutheight, all rows render (no virtualization, no infinite scroll). enableStickyParents(for grouped row parents) works in external scroll mode too — pinned parent rows stay just under the sticky header as you scroll past their children.
Padding on the scroll parent
If your scroll parent has padding-top, the table reads it and offsets the sticky header so it pins flush to the parent's outer top edge instead of sitting beneath the padding. No extra config required.