Beartropy Tables

Pagination
Configure table pagination with custom page sizes, dropdown options, and the ability to show all rows at once.

Pagination Settings

Control page size and available options via the settings() method.

Configure Pagination

usePagination(bool $bool) — Enable or disable pagination entirely. Enabled by default.

setPerPageDefault(int $number) — Set the initial number of rows per page.

setPerPageOptions(array $options) — Define the available page size options in the dropdown.

1$this->usePagination(true);
2$this->setPerPageDefault(50);
3$this->setPerPageOptions(['10', '25', '50', '100', 'Total']);

The "Total" option

Include 'Total' in setPerPageOptions() to let users display all rows on a single page. This is useful for smaller datasets where users want to see everything at once.

Disabling Pagination

Show all rows without pagination controls.

Disable Pagination

Set usePagination(false) to display all data rows without any pagination controls or page size selector.

1$this->usePagination(false);

Performance consideration

Disabling pagination loads all rows at once. For large datasets backed by Eloquent models, this can cause slow queries and high memory usage. Use with caution on tables with thousands of rows.

Examples

Playground tables demonstrating pagination configurations.

PaginatedUsersTable.php

Custom page size defaults and extended options including a "Total" option to show all rows.

1use App\Models\User;
2use Beartropy\Tables\Classes\Columns\Column;
3use Beartropy\Tables\Classes\Columns\DateColumn;
4use Beartropy\Tables\YATBaseTable;
5 
6class PaginatedUsersTable extends YATBaseTable
7{
8 public $model = User::class;
9 
10 public function columns(): array
11 {
12 return [
13 Column::make('Name', 'name')->sortable()->searchable(),
14 Column::make('Email', 'email')->sortable(),
15 DateColumn::make('Created', 'created_at')
16 ->outputFormat('M d, Y'),
17 ];
18 }
19 
20 public function settings(): void
21 {
22 $this->setPerPageDefault(5);
23 $this->setPerPageOptions(['5', '10', '25', '50', '100', 'Total']);
24 }
25}

NoPaginationTable.php

An array-based table with pagination disabled — all rows are displayed at once.

1use Beartropy\Tables\Classes\Columns\Column;
2use Beartropy\Tables\YATBaseTable;
3 
4class NoPaginationTable extends YATBaseTable
5{
6 public function columns(): array
7 {
8 return [
9 Column::make('#', 'id')->sortable(),
10 Column::make('City', 'city')->sortable()->searchable(),
11 Column::make('Country', 'country')->sortable()->searchable(),
12 Column::make('Population', 'population')->sortable()->pushRight(),
13 ];
14 }
15 
16 public function data(): array
17 {
18 return [
19 ['id' => 1, 'city' => 'Tokyo', 'country' => 'Japan', 'population' => '13,960,000'],
20 ['id' => 2, 'city' => 'Delhi', 'country' => 'India', 'population' => '11,030,000'],
21 // ... more rows
22 ];
23 }
24 
25 public function settings(): void
26 {
27 $this->usePagination(false);
28 }
29}

Live Demo

Try it — change pages and adjust the per-page selector.

Paginated Table

Paginated Table
#
#
City
Country
Population
1 1 Tokyo Japan 13,960,000
2 2 Delhi India 11,030,000
3 3 Shanghai China 24,870,000
4 4 Sao Paulo Brazil 12,330,000
5 5 Mexico City Mexico 9,210,000
Mostrando 1 A 5 De 18 Registros
1<livewire:tables.demos.demo-paginated-table />
Beartropy Logo

© 2026 Beartropy. All rights reserved.

Provided as-is, without warranty. Use at your own risk.