Browse components

TablePagination

import { TablePagination } from "@shpaw415/mui-lite/Pagination";

Why use it

TablePagination is the footer control for data tables: rows-per-page selector and page navigation. Use under a Table when data is paged on the server or client. Labels are localized via theme.locale.

Demo

Rows per page:

10

1-10 of 100

Example

import { useState } from "react";
import { TablePagination } from "@shpaw415/mui-lite/Pagination";
 
export function Footer({ count }: { count: number }) {
  const [page, setPage] = useState(0);
  const [rowsPerPage, setRowsPerPage] = useState<10 | 25 | 50 | 100>(10);
  return (
    <TablePagination
      count={count}
      page={page}
      rowsPerPage={rowsPerPage}
      onPageChange={(_e, p) => setPage(p)}
      onRowsPerPageChange={(r) => {
        setRowsPerPage(r);
        setPage(0);
      }}
    />
  );
}

Props

PropTypeDefault
countnumberrequired
pagenumber0
rowsPerPage10 | 25 | 50 | 10010
onPageChange(e, page) => void
onRowsPerPageChange(rows) => void
labelRowsPerPagestringlocalized
labelDisplayedRowsfunctionlocalized