themesberg / flowbite

Open-source UI component library and front-end development framework based on Tailwind CSS
https://flowbite.com
MIT License
7.35k stars 711 forks source link

Tabs with JS don't work as expected #734

Closed Sulfyderz closed 5 months ago

Sulfyderz commented 7 months ago

Describe the bug The JS part of tab doesn't work as expected (described here). I have copied and pasted your example and here are the bugs :

  1. const tabs = new Tabs(tabsElement, tabElements, options, instanceOptions);, you have to change the position of tabsElement with tabElements. Otherwise, the tab doesn't work;
  2. Even if you give the options argument to new Tabs(tabsElement, tabElements, options, instanceOptions);, it doesn't take it into consideration at all... defaultTabId, activeClasses, inactiveClasses and onShow are not taken into consideration;
  3. The unexpected workaround to only replicate activeClasses is to use aria-selected: selector to style the currently active tab.

To Reproduce

  1. Just copy and paste the example given in the official website here.

Expected behavior const tabs = new Tabs(tabsElement, tabElements, options, instanceOptions); should work as described here.

Desktop:

Additional context

dylanjcastillo commented 7 months ago

I also came across the same issue.

Sulfyderz commented 7 months ago

I also came across the same issue.

Use the version 2.0.0. Not later.

zoltanszogyenyi commented 5 months ago

Hey everyone,

I've used the example from the docs and updated the colors to red and seems to work with JS:

Screenshot 2024-01-26 at 15 45 34

Is the issue still persisting?

Thanks, Zoltan