Tailwind CSS Tabs
Build Tailwind CSS tabs with accessible tab panels, JavaScript behavior, underline, vertical, pill, segmented, scrollable, mobile-select, and hover variants.
Requires JS
Note that this component requires the use of our Tabs plugin, else you can skip this message if you are already using Preline UI as a package.
Behavior and accessibility
Use the Tabs plugin to build accessible Tailwind CSS tab panels that switch between local content panes with JavaScript.
Dynamic tabbed interfaces, as described in the WAI ARIA Authoring Practices, require role="tablist", role="tab", role="tabpanel", and additional aria- attributes in order to convey their structure, functionality and current state to users of assistive technologies (such as screen readers). As a best practice, we recommend using <button> elements for the tabs, as these are controls that trigger a dynamic change, rather than links that navigate to a new page or location.
Auto-centered tabs
Automatically scroll the tab list so the active tab stays centered.
Require JS
Note that this demo requires the use of our Scroll Nav plugin, else you can skip this message if you are already using Preline UI as a package. We also include Lodash to use the utility functions provided by this library.
This is the first item's tab body.
This is the second item's tab body.
This is the third item's tab body.
This is the fourth item's tab body.
This is the fifth item's tab body.
This is the sixth item's tab body.
This is the seventh item's tab body.
This is the eighth item's tab body.
This is the ninth item's tab body.
This is the tenth item's tab body.
This is the eleventh item's tab body.
This is the twelfth item's tab body.
This is the thirteenth item's tab body.
This is the fourteenth item's tab body.
This is the fifteenth item's tab body.
Vertical tabs
Stack the tab navigation vertically when it needs to sit beside the content.
Card-style tabs
Use a card-like container to visually separate the tab list from the page.
Scrollable tabs
Let the tab list scroll horizontally when there are more tabs than the available width.
Resize the example to see it in action.
Tabs with mobile select
Swap the tab list for a <select> on smaller screens to save horizontal space.
Resize the example to see it in action.
Fill and justify tabs
Stretch the tab list across the available width without forcing every item to be the same size.
Hover-triggered tabs New
Switch panes on hover instead of click for pointer-driven interactions.
Destroy and reinitialize
Use the destroy method to remove Tabs behavior before reinitializing it.