primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Tab displays incorrectly when wrapped with overlay badge

Open markallum opened this issue 1 year ago • 4 comments

Describe the bug

When a p-tab is wrapped with a p-overlaybadge, the tab displays out of a place and with an extra line underneath it.

Pull Request Link

No response

Reason for not contributing a PR

  • [x] Lack of time
  • [ ] Unsure how to implement the fix/feature
  • [ ] Difficulty understanding the codebase
  • [ ] Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/nosh6xwe-iccjbatu?file=src%2Fapp%2Fbadge-overlay-demo.html

Environment

Angular app using PrimeNG being developed on Windows.

Angular version

20.3.2

PrimeNG version

v20

Node version

22.14.0

Browser(s)

Chrome

Steps to reproduce the behavior

Wrap a p-tab in a p-overlaymodule

Expected behavior

The tab with the badge should display consistently next to other tabs. This issue seems to have occurred in a recent update.

markallum avatar Oct 14 '25 14:10 markallum

I found an example in the documentation that I adapted for this case. Does this solve your problem?

<div class="card flex flex-wrap justify-center gap-6">
  <p-tabs >
    <p-tablist>
      <p-tab value="0" class="flex items-center !gap-2">        
        <span>Regular Tab</span>
      </p-tab>
      <p-tab value="1" class="flex items-center !gap-2">
        <span style="margin-right: 0.50rem">Tab with badge</span>
        <p-overlaybadge value="2" />
      </p-tab>
      <p-tab value="2" class="flex items-center !gap-2">    
        <p-overlaybadge value="2">
          <span style="margin-right: 0.50rem">Tab with badge in overlay</span>
        </p-overlaybadge>
      </p-tab>
    </p-tablist>
  </p-tabs>
</div>

claarzu avatar Oct 14 '25 16:10 claarzu

Thanks, that works great for now. I also had to change the overflow to prevent the part of the badge that extends past the tab from being cut off:

.p-tablist, .p-tablist-viewport { overflow: visible !important; }

markallum avatar Oct 15 '25 10:10 markallum

Thanks, that works great for now. I also had to change the overflow to prevent the part of the badge that extends past the tab from being cut off:

.p-tablist, .p-tablist-viewport { overflow: visible !important; }

Have you tried setting the tablist to scrollable?

claarzu avatar Oct 15 '25 11:10 claarzu

This issue has been automatically marked as stale due to a lack of activity. If this issue is still relevant to you, please leave a comment so we can keep it open. We apologize for not being able to prioritize it sooner. If you have any new information or questions, please share them in your comment!

github-actions[bot] avatar Apr 14 '26 00:04 github-actions[bot]