Pagination component is not responsive (doesn't wrap)
See original GitHub issueBug description:
When pagination has enough pages to extend beyond the available width of the screen it doesn’t wrap. I tried adding
class="d-flex flex-wrap justify-content-center"
to the ngb-pagination html tag but that had no effect. It needs to be added the ul tag that has the pagination class applied to it to have an effect. As a hacky work-around in my style.scss Sass I use an extend on the .pagination class to include those other classes:
@import "~bootstrap/scss/bootstrap";
.pagination
{
@extend .d-flex, .flex-wrap, .justify-content-center;
}
If you remove the above class extend in the stackblitz’s style.scss example linked below you can see the default behavior.
For those who wish to not implement Sass, the following in style.css should also work:
.pagination
{
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
justify-content: center;
-webkit-justify-content: center;
flex-wrap : wrap;
-webkit-flex-wrap: wrap;
}
Link to minimally-working StackBlitz that reproduces the issue:
https://stackblitz.com/edit/bootstrap4paginationflex
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: 7.0.4
ng-bootstrap: 4.0.0
Bootstrap: 4.1.3
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Bootstrap 4 Pagination Scaling/Responsiveness
Bootstrap's Pagination component doesn't have any sort of intelligent, responsive behaviors baked into it (like the Grid).
Read more >Pagination - Bootstrap
Pagination is built with list HTML elements so screen readers can announce the number of available links. Use a wrapping <nav> element to...
Read more >Swiper React Components
Swiper is the most modern free mobile touch slider with hardware accelerated transitions and amazing native behavior.
Read more >Layout - dbc docs - Dash Bootstrap Components - Faculty AI
The content on this page has been centered by wrapping it in a Container component. By default the container has a responsive pixel...
Read more >Troubleshooting | Laravel Livewire
The solution is to ensure that you only have one root HTML element, such as a <div> . If you have multiple elements,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In my case, I faced the pagination width issue that exceeds the same as that
I fixed that by adding
[maxSize]="5"
@talynone I think that what @pkozlowski-opensource meant here is that we can’t see this behaviour on raw Bootstrap, this feature is not supported either in here.
On top of that, looking at your screenshots, I would strongly suggest not to do that. It would be terrible in term of user experience!
In that specific case, I would myself use the Advanced pagination with the option
Restricted size with rotation
So conclusion here might be sad 😞, but I will close this issue as we won’t probably ever fix that, especially that bootstrap is not supporting it…
You already have a workaround, if you really want to see it fixed, i would suggest you open a bug report on Bootstrap itself. If they implement it, you will get it here also for free !! 🎉