Skip to main content

Pagination

The <Table /> component natively supports pagination via the PaginationConfig prop.


function PageSelector(props: PageSelectorRendererProps) {
return (
<div className='flex justify-end mt-5'>
{Array(props.nPages)
.fill(0)
.map((_, i) => (
<div
key={i}
onClick={() => props.setPage(i)}
className={`items-center font-bold cursor-pointer px-4 py-2 border
text-sm hover:bg-gray-50
${
props.currentPage === i
? 'border-violet-800 text-violet-800 z-10'
: 'border-gray-200 text-gray-500'
} `}>
{i}
</div>
))}
</div>
);
info

The <Table /> component can sort data only if they are already available. If, on the other hand, the source is already paginated, retables can't infer the complete data set and it would therefore be impossible to indicate the number of page or apply sorting rules.

If you happen to be in this situation, you'll need to build yourself an external paging system.