You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Pagination] unexpected behavior when setting boundaryCount and siblingCount #24749
I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
1.) When i set the boundaryCount={0} just to show the current page and use the prev and next buttons. The current page is just displayed on the first page or last but isnt displayed when you navigate to any other page.
2.) When i set the boundaryCount={1} and the siblingCount={1} the pages that are shown add up.
a) For example when the current page is on 5 from 10 The shown pages are
< 1 ... 4 [5] 6 ... 10 > thats right.
b) When you are at page 4 it looks like this
< 1 2 3 [4] 5 ... 10 > and should be < 1 ... 3 [4] 5 ...>.
c) When you are at page 1 it looks like this
< [1] 2 3 4 5 ... 10 > and from my opinion should be like this < [1] 2 ... 10 >
Expected Behavior 🤔
1.) Show the current page any time :).
2.) a) is ok how it is
b) should be < 1 ... 3 [4] 5 ...>
c) should be < [1] 2 ... 10 >
Steps to Reproduce 🕹
I used the code Sandbox from the Examples and just changed the Props on the component.
https://codesandbox.io/s/bn7nw
and added the props like described above. For 1) boundaryCount={0} For 2) boundaryCount={1} and the siblingCount={1}
Context 🔦
Its a Navigation for a Responsive Website with Page Results that need Filters,Limits and navigation. Because its for Phones too it needs to be small sometimes.
Your Environment 🌎
`npx @material-ui/envinfo`
Don't forget to mention which browser you used.
Output from `npx @material-ui/envinfo` goes here.
I dont think the component keeps it width when you go up to a page count above 100 but if this is the reason i can understand point 2). I would maybe had drop the three points to keep the size.
But at point 1) its the same Reason? If so it makes no sense to me. the current page is much more important than the point or page count. I would had expected a solution like oliviertassinari posted.
To me first and last page is more important then the dots. And on small displays you dont really have the space. To me it looks good. The biggest issue was the missing of the current page in the current V4 version.
@fayzzzm What's the link with this issue? I don't think that the core logic should care about float. However, we could introduce a custom integer prop-type, we have a couple of other cases where PropTypes.number isn't ideal. If you want to work on it, contribution welcome 👍
@fayzzzm To be clear, we don't want to support count={1.03}, we want to throw a warning when developers try to us this API (at least, it seems to be what would make the most sense).
I am starting work on the remaining boundaryCount={0} and siblingCount={0} case. I will add a regression test for the compact previous/current/next output described in the maintainer proposal, while leaving other pagination configurations unchanged.
I reproduced the remaining case on current master: boundaryCount={0} with siblingCount={0} still emits start/end ellipses around the current page. I plan to implement the maintainer-proposed special case so the body contains only the current page, with a focused regression test. The August attempt has no linked or open PR after more than three weeks.
I opened #48954 for the compact-pagination case, including reachability and focus behavior. Linking it here to help coordinate the work and avoid duplicate implementations.
We discussed this as a team and decided against #24749 (comment). The ellipses carry useful information and are a separate concept from boundaryCount and siblingCount. An ellipsis means "more pages are hidden here", while those props set how many pages to show around the extremities and the current page. The intended behavior, which is also what Material UI renders today, is the following for count={10} boundaryCount={0} siblingCount={0}:
page
rendered
1
< [1] 2 … >
2
< 1 [2] … >
5
< … [5] … >
7
< … [7] … >
9
< … [9] 10 >
10
< … 9 [10] >
If you need a denser layout without ellipses, you can filter them out with renderItem:
For full control over the markup, use the usePagination hook. If you feel strongly that the ellipses should be removed by default, please open a new issue.
@lprnmns We think #49090 could meaningfully improve test coverage, so we'd like to adopt it once it's updated to follow this direction.
@Boulea7 Thanks for picking this up, and sorry the ready to take label sent you down this path. We'll close #48954 for now.
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@jhumpohl Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.
Activity
mbrookes commentedon Feb 2, 2021
This is by design, as it keeps the width of the pagination component stable.
oliviertassinari commentedon Feb 2, 2021
@mbrookes I agree with point 2), the request is invalid, we should keep pagination width stable. However, on point 1, this
seems to behave strangely https://codesandbox.io/s/material-demo-forked-2nkvf?file=/demo.js.
oliviertassinari commentedon Feb 2, 2021
For instance, on page 7, we get:
why not the following?
or even
jhumpohl commentedon Feb 3, 2021
I dont think the component keeps it width when you go up to a page count above 100 but if this is the reason i can understand point 2). I would maybe had drop the three points to keep the size.
But at point 1) its the same Reason? If so it makes no sense to me. the current page is much more important than the point or page count. I would had expected a solution like oliviertassinari posted.
But anyway thx for the quick awnser and support.
oliviertassinari commentedon Feb 13, 2021
So, I had a look at the issue. It turns out that we have already fixed most of the issue in v5: https://codesandbox.io/s/material-demo-forked-2nkvf?file=/demo.js.
Having a second thought about it, I would propose that for:
It renders:
Instead of:
It allows to have a denser display, the dots don't really add much. I could make it work with this diff:
Should we move forward with it?
jhumpohl commentedon Feb 15, 2021
To me first and last page is more important then the dots. And on small displays you dont really have the space. To me it looks good. The biggest issue was the missing of the current page in the current V4 version.
Nice job!
fayzzzm commentedon Feb 26, 2021
@oliviertassinari, I know it could be a stupid question from me, but what if the developer passes count float value
and next button won't be disabled due to this line of code
disabled: disabled || (item.indexOf('ellipsis') === -1 && (item === 'next' || item === 'last' ? page >= count : page <= 1))Pagination code link
What if instead of checking
page >= countmakepage >= parseInt(count)or toparseIntit at the beginning.oliviertassinari commentedon Feb 26, 2021
@fayzzzm What's the link with this issue? I don't think that the core logic should care about float. However, we could introduce a custom integer prop-type, we have a couple of other cases where PropTypes.number isn't ideal. If you want to work on it, contribution welcome 👍
fayzzzm commentedon Feb 26, 2021
Ok, I will create an issue and you can have a look at it. We could discuss props validating after if it's ok?
oliviertassinari commentedon Feb 26, 2021
@fayzzzm To be clear, we don't want to support
count={1.03}, we want to throw a warning when developers try to us this API (at least, it seems to be what would make the most sense).fayzzzm commentedon Feb 26, 2021
@oliviertassinari Got you!
Boulea7 commentedon Aug 12, 2026
I am starting work on the remaining boundaryCount={0} and siblingCount={0} case. I will add a regression test for the compact previous/current/next output described in the maintainer proposal, while leaving other pagination configurations unchanged.
lprnmns commentedon Sep 4, 2026
I reproduced the remaining case on current master: boundaryCount={0} with siblingCount={0} still emits start/end ellipses around the current page. I plan to implement the maintainer-proposed special case so the body contains only the current page, with a focused regression test. The August attempt has no linked or open PR after more than three weeks.
Boulea7 commentedon Oct 8, 2026
I opened #48954 for the compact-pagination case, including reachability and focus behavior. Linking it here to help coordinate the work and avoid duplicate implementations.
Janpot commentedon Oct 26, 2026
We discussed this as a team and decided against #24749 (comment). The ellipses carry useful information and are a separate concept from
boundaryCountandsiblingCount. An ellipsis means "more pages are hidden here", while those props set how many pages to show around the extremities and the current page. The intended behavior, which is also what Material UI renders today, is the following forcount={10} boundaryCount={0} siblingCount={0}:< [1] 2 … >< 1 [2] … >< … [5] … >< … [7] … >< … [9] 10 >< … 9 [10] >If you need a denser layout without ellipses, you can filter them out with
renderItem:For full control over the markup, use the usePagination hook. If you feel strongly that the ellipses should be removed by default, please open a new issue.
@lprnmns We think #49090 could meaningfully improve test coverage, so we'd like to adopt it once it's updated to follow this direction.
@Boulea7 Thanks for picking this up, and sorry the ready to take label sent you down this path. We'll close #48954 for now.
github-actions commentedon Oct 26, 2026
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@jhumpohl Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.