Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Issue styling tabs with radio tabs #2718

Closed
itaiperi opened this issue Jan 1, 2024 · 2 comments
Closed

bug: Issue styling tabs with radio tabs #2718

itaiperi opened this issue Jan 1, 2024 · 2 comments

Comments

@itaiperi
Copy link

itaiperi commented Jan 1, 2024

What version of daisyUI are you using?

v4.4.24

Which browsers are you seeing the problem on?

Chrome

Reproduction URL

https://play.tailwindcss.com/fpT7ztW4FM

Describe your issue

Hi,
I'm having an issue trying to style my tabs.
I want to have bordered radio tabs (with content), but with a gap between them.
Since the tabs class is actually a grid, I thought I'd add a gap-4 to space between the tabs.
What ended up happening, is that my content became about 160k pixels wide.
From my investigation, it has to do with this line.
It seems that spanning the tab-content class across span 9999 doesn't matter if there are no gaps, but if there are gaps - this causes the existence of 9999 gaps, which causes the very wide content container.

For now I solved it by putting mr-4 on each of the tabs but the last one, but I think this is an inherent problem that might cause other issues as well, and might be appropriate to address.

Here's a minimal reproducible example:

<div role="tablist" class="tabs tabs-bordered gap-4">
  <input type="radio" name="my_tabs_1" role="tab" class="tab" aria-label="Tab 1" />
  <div role="tabpanel" class="tab-content p-10 border-red-500">Tab content 1</div>

  <input type="radio" name="my_tabs_1" role="tab" class="tab" aria-label="Tab 2" checked />
  <div role="tabpanel" class="tab-content p-10 border-yellow-500">Tab content 2</div>

  <input type="radio" name="my_tabs_1" role="tab" class="tab" aria-label="Tab 3" />
  <div role="tabpanel" class="tab-content p-10 border-green-500">Tab content 3</div>
</div>
Copy link

github-actions bot commented Jan 1, 2024

Thank you @itaiperi for reporting issues. It helps daisyUI a lot 💚
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.

@saadeghi
Copy link
Owner

saadeghi commented Jan 2, 2024

All direct children of tabs are placed using grid, including the tab and the tab-content and adding gap to all of them breaks the layout. Instead you can add a class name like [&>input]:me-4 to add a margin, only for the tab:
https://play.tailwindcss.com/mPNWpjaQHX

Let me know if you have a question.

@saadeghi saadeghi closed this as completed Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants