question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pagination component is not responsive (doesn't wrap)

See original GitHub issue

Bug 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:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
syedsaadqamarcommented, May 20, 2020

In my case, I faced the pagination width issue that exceeds the same as that 49165467-93000800-f331-11e8-98ca-4dd1c847e384

I fixed that by adding [maxSize]="5"

1reaction
benouatcommented, Nov 28, 2018

@talynone this is not what I’m seeing…

@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.

image

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

image

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 !! 🎉

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found