Pagination
Compact pager under a table: previous, the position (3 dari 447) and next.
Usage
import { Pagination } from '@pilar-amoda/ui/pagination';Table footer
page starts at 1. Previous is disabled on the first page and next on the last; pass disabled while the next page loads. With pageCount 0 it shows 0 dari 0.
'use client';
import { useState } from 'react';
import { Pagination } from '@pilar-amoda/ui/pagination';
export const PaginationBasic = () => {
const [page, setPage] = useState(1);
return (
<Pagination
page={page}
pageCount={447}
onPageChange={setPage}
previousButtonProps={{ 'data-testid': 'btnPrevious_Pagination' }}
nextButtonProps={{ 'data-testid': 'btnNext_Pagination' }}
/>
);
};Do and don't
Do: show the total rows next to the pager (Menampilkan 1–20 dari 8.926).
Don't: page through data the server already sent in full; let the table scroll.