Skip to content

How to set default page size? #2029

Answered by KevinVandy
BarishSarac asked this question in General
Discussion options

You must be logged in to vote

From the official pagination guide:

Pagination State
Whether or not you are using client-side or manual server-side pagination, you can use the built-in pagination state state and APIs.

The pagination state is an object that contains the following properties:

pageIndex: The current page index (zero-based).
pageSize: The current page size.
You can manage the pagination state just like any other state in the table instance.

import { useReactTable, getCoreRowModel, getPaginationRowModel } from '@tanstack/react-table';
//...
const [pagination, setPagination] = useState({
  pageIndex: 0, //initial page index
  pageSize: 10, //default page size
});

const table = useReactTable({
  columns,
  data,

Replies: 8 comments 14 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@papidracul
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@ryanbakker
Comment options

@gonsura
Comment options

@dankwx
Comment options

@travistylervii
Comment options

@KevinVandy
Comment options

Comment options

You must be logged in to vote
2 replies
@sp88011
Comment options

@hello-isa
Comment options

Comment options

You must be logged in to vote
2 replies
@FMcreativo
Comment options

@hello-isa
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by KevinVandy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment