Skip to content

Commit 32f5d02

Browse files
committed
paginationComponentOptions.minWindowWidth (defaults to SMALL == 599)
1 parent 59c6ac1 commit 32f5d02

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/DataTable/Pagination.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ function Pagination({
9595
}: PaginationProps): JSX.Element {
9696
const windowSize = useWindowSize();
9797
const isRTL = useRTL(direction);
98-
const shouldShow = windowSize.width && windowSize.width > SMALL;
98+
const { minWindowWidth = SMALL } = paginationComponentOptions;
99+
const windowWidth = windowSize.width;
100+
const shouldShow = !minWindowWidth || (windowWidth && windowWidth > minWindowWidth);
99101
// const isRTL = detectRTL(direction);
100102
const numPages = getNumberOfPages(rowCount, rowsPerPage);
101103
const lastIndex = currentPage * rowsPerPage;

src/DataTable/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ export interface TableStyles {
218218

219219
export interface PaginationOptions {
220220
noRowsPerPage?: boolean;
221+
// If non-null, the "rows per page" dropdown will be hidden when the window width is less than
222+
// this value. SMALL == 599 is the default (if this property is undefined); pass `null` to always
223+
// show the dropdown (useful for ensuring SSR matches client).
224+
minWindowWidth?: number | null;
221225
rowsPerPageText?: string;
222226
rangeSeparatorText?: string;
223227
selectAllRowsItem?: boolean;

0 commit comments

Comments
 (0)