← Back to Docs

Table Pagination

Server-driven pagination patterns for large datasets with cursor and offset strategies.

Cursor-Based

Best for real-time feeds and infinite scroll. Use a unique, sortable column as the cursor.

GET /api/users?cursor=abc123&limit=20
→ { data: [...], nextCursor: "xyz789" }

Offset / Limit

Classic page-number navigation. Works well when total row count is known and stable.

GET /api/users?offset=40&limit=20
→ { data: [...], total: 200 }

Page Controls

Prev123...12Next

Key Decisions

  • Cursor pagination avoids row-shift bugs when data mutates under you.
  • Offset pagination is simpler for admin panels with predictable row counts.
  • Always return total or hasMore so the client knows when to stop.
  • Keep limit reasonable (20–100). Large limits defeat the purpose of pagination.