Paginated Table

This module wraps the Shadcn/UI Table components with Laravel's default paginator. The provided integration example uses inertia as the data source.

Installation

pnpm dlx shadcn@latest add https://astrify.com/r/paginated-table.json

Usage

This usage example loads data via Inertia requests. As you paginate this table the page number would be reflected in the address bar. To load data via JSON fetch requests see the Json Table Module.

resources/js/pages/inertia-table-example.tsx
routes/web.php

Optionally seed your database with test data to see the pagination in action:

artisan tinker
\App\Models\User::factory(100)->create();

Props

PaginatedTable

PropTypeDescription
columnsstring[]Array of column header labels
data(string | number)[][]2D array of table data rows
paginationPaginatorConfigPagination configuration object
placeholderReact.ReactNode (optional)Custom content to show when data is empty (loading, errors, empty states)

PaginatorConfig

PropTypeDescription
type"simple" | "numeric"The pagination style to use
currentPagenumberCurrent page number
lastPagenumberTotal number of pages
linksPaginationLinkType[]Array of pagination link objects from Laravel
onChangePage(url: string | null) => voidCallback function when page changes
totalnumber (optional)Total number of records

PaginationLinkType

PropTypeDescription
urlstring | nullURL for the pagination link
labelstringLabel text for the link
activebooleanWhether this link is active