Demos
Infinity scroller with load button
A load button is shown at the bottom by having use_load_button={true}
- but here we define our startup_page={5}
, so we also get a load button on top.
<HeightLimit><Paginationmode="infinity"use_load_buttonstartup_page={5}min_wait_time={0}on_load={({ pageNumber, setContent }) => {// simulate server communication delayconst timeout = setTimeout(() => {setContent(pageNumber, <LargePage>{pageNumber}</LargePage>)}, Math.ceil(Math.random() * 500))return () => clearTimeout(timeout)}}/></HeightLimit>
Infinity scroller with custom load indicator
<HeightLimit><Paginationmode="infinity"indicator_element={() => (<LargePage color="lightgreen">Loading ...</LargePage>)}startup_page={3}page_count={10}min_wait_time={0}on_load={({ pageNumber, setContent }) => {// simulate server communication delayconst timeout = setTimeout(() => {setContent(pageNumber, <LargePage>{pageNumber}</LargePage>)}, Math.ceil(Math.random() * 500))return () => clearTimeout(timeout)}}on_end={({ pageNumber, setContent }) => {setContent(pageNumber, <LargePage color="lightgreen">End</LargePage>)}}/></HeightLimit>
page_count
Infinity scroller with unknown <HeightLimit><Paginationmode="infinity"parallel_load_count={2}min_wait_time={0}on_load={({ pageNumber, setContent, endInfinity }) => {// simulate server communication delayconst timeout = setTimeout(() => {if (pageNumber > 10) {endInfinity()} else {setContent(pageNumber, <LargePage>{pageNumber}</LargePage>)}}, Math.ceil(Math.random() * 1e3))return () => clearTimeout(timeout)}}on_end={({ pageNumber, setContent }) => {setContent(pageNumber, <LargePage color="lightgreen">End</LargePage>)}}/></HeightLimit>
Advanced Table infinity scroller
You can find the code either on GitHub or on CodeSandbox
Infinity Table
This is a semantic correct table using infinity scrolling. It also has a sticky header.
- The startup page number is set to 3.
- And per page we show 10 items.
- A random delay is added to simulate asynchronous interaction.
<HeightLimit height="60rem"><PaginationTableExample /></HeightLimit>