GLS Registry

Paginated Table

A paginated table wrapper for a TanStack Table instance, with keyboard navigation and empty and loading states.

NombreParcel Shop
AnaMadrid Centro
LuisBarcelona Eixample
MartaValencia Ruzafa
PabloSevilla Norte
IreneBilbao Casco

Página 1 de 2

Installation

pnpm dlx shadcn@latest add @ecodeliver/paginated-table

Usage

Build the table with useReactTable and pass the instance in. Page size options are 1, 3, 5, 10, and 100. Columns with id select or actions render narrower than the rest.

import {
  getCoreRowModel,
  getPaginationRowModel,
  useReactTable,
} from "@tanstack/react-table";
import PaginatedTable from "@/components/registry/paginated-table";

const columns = [{ accessorKey: "name", header: "Name" }];

export function Example() {
  const table = useReactTable({
    data: [{ name: "Alice" }, { name: "Bob" }],
    columns,
    getCoreRowModel: getCoreRowModel(),
    getPaginationRowModel: getPaginationRowModel(),
  });

  return <PaginatedTable table={table} />;
}

Keyboard shortcuts

  • Left / Right: previous / next page
  • Home / End: first / last page

API Reference

PaginatedTable

PaginatedTable is a default export. The empty-state copy is Spanish.

PropTypeDefault
tableTable<T>-
emptyobject-
isPendingboolean-

empty

PropTypeDefault
titlestring"No se encontraron resultados"
descriptionstring"Intenta ajustar los filtros o realizar una nueva búsqueda"
iconReactNode<SearchX />

On this page