Tabs components are adopted from Preline UI components using Preline’s unstyled, headless Tailwind plugins to deliver accessible and responsive user interfaces.
Class Name
Type
Description
tabs
Component
Base class for tabs container.
tab
Component
Base class for tab items.
tabs-bordered
Style
This class adds a bottom border to each tab item.
tabs-lifted
Style
This class applies a lifted style to each tab item.
tab-active
State
active state for tabs-bordered and tabs-lifted.
active
State
Enables the selection of a tab to be initially displayed.
active-tab:{tw-utility-class}
Variant
The modifier allows setting Tailwind classes when the tab is active for toggle and for content.
Utilize the tab JavaScript plugin to improve our navigation tabs and pills, allowing us to create tabbed sections with different content.
For dynamic tabbed interfaces, it’s important to include specific elements like role="tablist", role="tab", role="tabpanel", and other attributes as outlined in the WAI ARIA Authoring Practices. These help convey the structure and functionality to users who rely on assistive technologies like screen readers. As a good practice, use button elements for the tabs instead of links to ensure they trigger changes without navigating to new pages.
Style:
The tabs class serves as the base component for tabbed interfaces, where adding the tabs-bordered class gives the tab buttons an underlined appearance. The tab class is applied to individual tab buttons, and using the active class marks a tab as the initial active tab. The active-tab:{tw-utility-class} modifier allows Tailwind utility classes to be applied when the tab is active.
Functionality:
The data-tab data attribute is used to link each tab button to its corresponding tabpanel using an ID. It’s crucial to set the role attribute on both the tab and tabpanel elements to ensure proper functionality and accessibility.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-basic-item-1"data-tab="#tabs-basic-1"aria-controls="tabs-basic-1"role="tab"aria-selected="true" >
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-basic-item-2"data-tab="#tabs-basic-2"aria-controls="tabs-basic-2"role="tab"aria-selected="false" >
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-basic-item-3"data-tab="#tabs-basic-3"aria-controls="tabs-basic-3"role="tab"aria-selected="false" >
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-basic-1"role="tabpanel"aria-labelledby="tabs-basic-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-basic-2"class="hidden"role="tabpanel"aria-labelledby="tabs-basic-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-basic-3"class="hidden"role="tabpanel"aria-labelledby="tabs-basic-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active w-full"id="tabs-basic-filled-item-1"data-tab="#tabs-basic-filled-1"aria-controls="tabs-basic-filled-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active w-full"id="tabs-basic-filled-item-2"data-tab="#tabs-basic-filled-2"aria-controls="tabs-basic-filled-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active w-full"id="tabs-basic-filled-item-3"data-tab="#tabs-basic-filled-3"aria-controls="tabs-basic-filled-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-basic-filled-1"role="tabpanel"aria-labelledby="tabs-basic-filled-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-basic-filled-2"class="hidden"role="tabpanel"aria-labelledby="tabs-basic-filled-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-basic-filled-3"class="hidden"role="tabpanel"aria-labelledby="tabs-basic-filled-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
To create vertical tabs, you can use the tabs-vertical class. Additionally, you should add a flex class to a surrounding div to ensure the tabs and their associated content are displayed side by side.
For keyboard accessibility to function properly, please set data-attribute data-tabs-vertical to true.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<divclass="flex">
<navclass="tabs tabs-bordered tabs-vertical"aria-label="Tabs"role="tablist"data-tabs-vertical="true"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-vertical-item-1"data-tab="#tabs-vertical-1"aria-controls="tabs-vertical-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-vertical-item-2"data-tab="#tabs-vertical-2"aria-controls="tabs-vertical-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active "id="tabs-vertical-item-3"data-tab="#tabs-vertical-3"aria-controls="tabs-vertical-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="ms-3">
<divid="tabs-vertical-1"role="tabpanel"aria-labelledby="tabs-vertical-item-1">
<pclass="text-base-content/80"> Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here. </p>
</div>
<divid="tabs-vertical-2"class="hidden"role="tabpanel"aria-labelledby="tabs-vertical-item-2">
<pclass="text-base-content/80"> This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details. </p>
</div>
<divid="tabs-vertical-3"class="hidden"role="tabpanel"aria-labelledby="tabs-vertical-item-3">
<pclass="text-base-content/80"> <spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations. </p>
</div>
</div>
</div>
Add responsive class tabs-{size} where {size} = xs|sm|md|lg|xl for tab of different sizes.
Welcome to the
Home tab!
Explore the latest updates and news here.
This is your
Profile
tab, where you can update your personal information and manage your account details.
Messages:
View your recent messages, chat with friends, and manage your conversations.
<!-- Extra small --><navclass="tabs tabs-bordered tabs-xs"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-xs-item-1"data-tab="#tabs-xs-1"aria-controls="tabs-xs-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-xs-item-2"data-tab="#tabs-xs-2"aria-controls="tabs-xs-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-xs-item-3"data-tab="#tabs-xs-3"aria-controls="tabs-xs-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-1.5">
<divid="tabs-xs-1"role="tabpanel"aria-labelledby="tabs-xs-item-1">
<pclass="text-base-content/80 text-sm">
Welcome to the
<spanclass="text-base-content font-semibold">Home tab!</span>
Explore the latest updates and news here.
</p>
</div>
<divid="tabs-xs-2"class="hidden"role="tabpanel"aria-labelledby="tabs-xs-item-2">
<pclass="text-base-content/80 text-sm">
This is your
<spanclass="text-base-content font-semibold">Profile</span>
tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-xs-3"class="hidden"role="tabpanel"aria-labelledby="tabs-xs-item-3">
<pclass="text-base-content/80 text-sm">
<spanclass="text-base-content font-semibold">Messages:</span>
View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Add responsive class tabs-{size} where {size} = xs|sm|md|lg|xl for tab of different sizes.
Welcome to the
Home tab!
Explore the latest updates and news here.
This is your
Profile
tab, where you can update your personal information and manage your account details.
Messages:
View your recent messages, chat with friends, and manage your conversations.
<!-- Small --><navclass="tabs tabs-bordered tabs-sm"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-sm-item-1"data-tab="#tabs-sm-1"aria-controls="tabs-sm-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-sm-item-2"data-tab="#tabs-sm-2"aria-controls="tabs-sm-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-sm-item-3"data-tab="#tabs-sm-3"aria-controls="tabs-sm-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-2">
<divid="tabs-sm-1"role="tabpanel"aria-labelledby="tabs-sm-item-1">
<pclass="text-base-content/80 text-sm">
Welcome to the
<spanclass="text-base-content font-semibold">Home tab!</span>
Explore the latest updates and news here.
</p>
</div>
<divid="tabs-sm-2"class="hidden"role="tabpanel"aria-labelledby="tabs-sm-item-2">
<pclass="text-base-content/80 text-sm">
This is your
<spanclass="text-base-content font-semibold">Profile</span>
tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-sm-3"class="hidden"role="tabpanel"aria-labelledby="tabs-sm-item-3">
<pclass="text-base-content/80 text-sm">
<spanclass="text-base-content font-semibold">Messages:</span>
View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Add responsive class tabs-{size} where {size} = xs|sm|md|lg|xl for tab of different sizes.
Welcome to the
Home tab!
Explore the latest updates and news here.
This is your
Profile
tab, where you can update your personal information and manage your account details.
Messages:
View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered tabs-md"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-default-item-1"data-tab="#tabs-default-1"aria-controls="tabs-default-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-default-item-2"data-tab="#tabs-default-2"aria-controls="tabs-default-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-default-item-3"data-tab="#tabs-default-3"aria-controls="tabs-default-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-2.5">
<divid="tabs-default-1"role="tabpanel"aria-labelledby="tabs-default-item-1">
<pclass="text-base-content/80 text-lg">
Welcome to the
<spanclass="text-base-content font-semibold">Home tab!</span>
Explore the latest updates and news here.
</p>
</div>
<divid="tabs-default-2"class="hidden"role="tabpanel"aria-labelledby="tabs-default-item-2">
<pclass="text-base-content/80 text-lg">
This is your
<spanclass="text-base-content font-semibold">Profile</span>
tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-default-3"class="hidden"role="tabpanel"aria-labelledby="tabs-default-item-3">
<pclass="text-base-content/80 text-lg">
<spanclass="text-base-content font-semibold">Messages:</span>
View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Add responsive class tabs-{size} where {size} = xs|sm|md|lg|xl for tab of different sizes.
Welcome to the
Home tab!
Explore the latest updates and news here.
This is your
Profile
tab, where you can update your personal information and manage your account details.
Messages:
View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered tabs-lg overflow-x-auto"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-large-item-1"data-tab="#tabs-large-1"aria-controls="tabs-large-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-large-item-2"data-tab="#tabs-large-2"aria-controls="tabs-large-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-large-item-3"data-tab="#tabs-large-3"aria-controls="tabs-large-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3.5">
<divid="tabs-large-1"role="tabpanel"aria-labelledby="tabs-large-item-1">
<pclass="text-base-content/80 text-lg">
Welcome to the
<spanclass="text-base-content font-semibold">Home tab!</span>
Explore the latest updates and news here.
</p>
</div>
<divid="tabs-large-2"class="hidden"role="tabpanel"aria-labelledby="tabs-large-item-2">
<pclass="text-base-content/80 text-lg">
This is your
<spanclass="text-base-content font-semibold">Profile</span>
tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-large-3"class="hidden"role="tabpanel"aria-labelledby="tabs-large-item-3">
<pclass="text-base-content/80 text-lg">
<spanclass="text-base-content font-semibold">Messages:</span>
View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Add responsive class tabs-{size} where {size} = xs|sm|md|lg|xl for tab of different sizes.
Welcome to the
Home tab!
Explore the latest updates and news here.
This is your
Profile
tab, where you can update your personal information and manage your account details.
Messages:
View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered tabs-xl overflow-x-auto"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-extra-large-item-1"data-tab="#tabs-extra-large-1"aria-controls="tabs-extra-large-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-extra-large-item-2"data-tab="#tabs-extra-large-2"aria-controls="tabs-extra-large-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-extra-large-item-3"data-tab="#tabs-extra-large-3"aria-controls="tabs-extra-large-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3.5">
<divid="tabs-extra-large-1"role="tabpanel"aria-labelledby="tabs-extra-large-item-1">
<pclass="text-base-content/80 text-lg">
Welcome to the
<spanclass="text-base-content font-semibold">Home tab!</span>
Explore the latest updates and news here.
</p>
</div>
<divid="tabs-extra-large-2"class="hidden"role="tabpanel"aria-labelledby="tabs-extra-large-item-2">
<pclass="text-base-content/80 text-lg">
This is your
<spanclass="text-base-content font-semibold">Profile</span>
tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-extra-large-3"class="hidden"role="tabpanel"aria-labelledby="tabs-extra-large-item-3">
<pclass="text-base-content/80 text-lg">
<spanclass="text-base-content font-semibold">Messages:</span>
View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered justify-center"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-center-item-1"data-tab="#tabs-center-1"aria-controls="tabs-center-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-center-item-2"data-tab="#tabs-center-2"aria-controls="tabs-center-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-center-item-3"data-tab="#tabs-center-3"aria-controls="tabs-center-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-center-1"role="tabpanel"aria-labelledby="tabs-center-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-center-2"class="hidden"role="tabpanel"aria-labelledby="tabs-center-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-center-3"class="hidden"role="tabpanel"aria-labelledby="tabs-center-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered justify-end"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-end-item-1"data-tab="#tabs-end-1"aria-controls="tabs-end-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-end-item-2"data-tab="#tabs-end-2"aria-controls="tabs-end-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-end-item-3"data-tab="#tabs-end-3"aria-controls="tabs-end-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-end-1"role="tabpanel"aria-labelledby="tabs-end-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-end-2"class="hidden"role="tabpanel"aria-labelledby="tabs-end-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-end-3"class="hidden"role="tabpanel"aria-labelledby="tabs-end-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered overflow-x-auto"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-icons-item-1"data-tab="#tabs-icons-1"aria-controls="tabs-icons-1"role="tab"aria-selected="true">
<spanclass="icon-[tabler--home] size-5 shrink-0 me-2"></span>
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-icons-item-2"data-tab="#tabs-icons-2"aria-controls="tabs-icons-2"role="tab"aria-selected="false">
<spanclass="icon-[tabler--user] size-5 shrink-0 me-2"></span>
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-icons-item-3"data-tab="#tabs-icons-3"aria-controls="tabs-icons-3"role="tab"aria-selected="false">
<spanclass="icon-[tabler--message] size-5 shrink-0 me-2"></span>
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-icons-1"role="tabpanel"aria-labelledby="tabs-icons-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-icons-2"class="hidden"role="tabpanel"aria-labelledby="tabs-icons-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-icons-3"class="hidden"role="tabpanel"aria-labelledby="tabs-icons-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered overflow-x-auto"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-badges-item-1"data-tab="#tabs-badges-1"aria-controls="tabs-badges-1"role="tab"aria-selected="true">
Home
<spanclass="badge badge-soft badge-primary badge-sm ms-2 rounded-full">+99</span>
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-badges-item-2"data-tab="#tabs-badges-2"aria-controls="tabs-badges-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-badges-item-3"data-tab="#tabs-badges-3"aria-controls="tabs-badges-3"role="tab"aria-selected="false">
Messages
<spanclass="badge badge-soft badge-primary badge-sm ms-2 rounded-full">+200</span>
</button>
</nav>
<divclass="mt-3">
<divid="tabs-badges-1"role="tabpanel"aria-labelledby="tabs-badges-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-badges-2"class="hidden"role="tabpanel"aria-labelledby="tabs-badges-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-badges-3"class="hidden"role="tabpanel"aria-labelledby="tabs-badges-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Apply the tabs-lifted component class along with tabs to display the tab in a lifted style.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-lifted"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-lifted-item-1"data-tab="#tabs-lifted-1"aria-controls="tabs-lifted-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-lifted-item-2"data-tab="#tabs-lifted-2"aria-controls="tabs-lifted-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-lifted-item-3"data-tab="#tabs-lifted-3"aria-controls="tabs-lifted-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-lifted-1"role="tabpanel"aria-labelledby="tabs-lifted-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-lifted-2"class="hidden"role="tabpanel"aria-labelledby="tabs-lifted-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-lifted-3"class="hidden"role="tabpanel"aria-labelledby="tabs-lifted-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
When content extends beyond the screen, a horizontal scrollbar ensures the tab bar remains aligned. Apply the overflow-x-auto class for a scrollbar. Resize the window to see an example.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
Settings: Adjust your preferences, manage your account, and configure your privacy settings here.
Help: Find answers to frequently asked questions, get in touch with support, or read through user guides.
Notifications: Manage your notifications, set preferences, and view your notification history.
Feedback: Share your thoughts, report issues, or suggest new features to improve the platform.
<navclass="tabs tabs-bordered overflow-x-auto"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-scroll-item-1"data-tab="#tabs-scroll-1"aria-controls="#tabs-scroll-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-scroll-item-2"data-tab="#tabs-scroll-2"aria-controls="#tabs-scroll-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-scroll-item-3"data-tab="#tabs-scroll-3"aria-controls="#tabs-scroll-3"role="tab"aria-selected="false">
Messages
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-scroll-item-4"data-tab="#tabs-scroll-4"aria-controls="#tabs-scroll-4"role="tab"aria-selected="false">
Settings
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-scroll-item-5"data-tab="#tabs-scroll-5"aria-controls="#tabs-scroll-5"role="tab"aria-selected="false">
Help
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-scroll-item-6"data-tab="#tabs-scroll-6"aria-controls="#tabs-scroll-6"role="tab"aria-selected="false">
Notifications
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-scroll-item-7"data-tab="#tabs-scroll-7"aria-controls="#tabs-scroll-7"role="tab"aria-selected="false">
Feedback
</button>
</nav>
<divclass="mt-3">
<divid="tabs-scroll-1"role="tabpanel"aria-labelledby="tabs-scroll-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-scroll-2"class="hidden"role="tabpanel"aria-labelledby="tabs-scroll-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-scroll-3"class="hidden"role="tabpanel"aria-labelledby="tabs-scroll-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
<divid="tabs-scroll-4"class="hidden"role="tabpanel"aria-labelledby="tabs-scroll-item-4">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Settings:</span> Adjust your preferences, manage your account, and configure your privacy settings here.
</p>
</div>
<divid="tabs-scroll-5"class="hidden"role="tabpanel"aria-labelledby="tabs-scroll-item-5">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Help:</span> Find answers to frequently asked questions, get in touch with support, or read through user guides.
</p>
</div>
<divid="tabs-scroll-6"class="hidden"role="tabpanel"aria-labelledby="tabs-scroll-item-6">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Notifications:</span> Manage your notifications, set preferences, and view your notification history.
</p>
</div>
<divid="tabs-scroll-7"class="hidden"role="tabpanel"aria-labelledby="tabs-scroll-item-7">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Feedback:</span> Share your thoughts, report issues, or suggest new features to improve the platform.
</p>
</div>
</div>
This example demonstrates tabs that dynamically open and close on hover, highlighting the use of eventType:.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered"aria-label="Tabs"role="tablist"aria-orientation="horizontal"data-tabs='{
"eventType": "hover"
}'>
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-hover-item-1"data-tab="#tabs-hover-1"aria-controls="tabs-hover-1"role="tab"aria-selected="true" >
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-hover-item-2"data-tab="#tabs-hover-2"aria-controls="tabs-hover-2"role="tab"aria-selected="false" >
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-hover-item-3"data-tab="#tabs-hover-3"aria-controls="tabs-hover-3"role="tab"aria-selected="false" >
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-hover-1"role="tabpanel"aria-labelledby="tabs-hover-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-hover-2"class="hidden"role="tabpanel"aria-labelledby="tabs-hover-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-hover-3"class="hidden"role="tabpanel"aria-labelledby="tabs-hover-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
The destroymethod is provided to facilitate the destruction of a tab element.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navid="tabs-to-destroy"class="tabs tabs-bordered"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-destroy-item-1"data-tab="#tabs-destroy-1"aria-controls="tabs-destroy-1"role="tab"aria-selected="true" >
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-destroy-item-2"data-tab="#tabs-destroy-2"aria-controls="tabs-destroy-2"role="tab"aria-selected="false" >
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-destroy-item-3"data-tab="#tabs-destroy-3"aria-controls="tabs-destroy-3"role="tab"aria-selected="false" >
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-destroy-1"role="tabpanel"aria-labelledby="tabs-destroy-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-destroy-2"class="hidden"role="tabpanel"aria-labelledby="tabs-destroy-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-destroy-3"class="hidden"role="tabpanel"aria-labelledby="tabs-destroy-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
<divclass="mt-4 flex gap-3">
<buttonclass="btn btn-primary"id="destroy-btn">Destroy</button>
<buttonclass="btn btn-primary"id="reinit-btn"disabled>Reinitialize</button>
</div>
The demonstration illustrates responsiveness by showcasing how the tabs switch to a select menu on smaller screens.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<selectid="tab-select"class="select sm:hidden inline-flex"aria-label="Tabs">
<optionvalue="#tabs-responsive-1">Home</option>
<optionvalue="#tabs-responsive-2">Profile</option>
<optionvalue="#tabs-responsive-3">Messages</option>
</select>
<navclass="tabs tabs-bordered hidden sm:flex"aria-label="Tabs"role="tablist"data-tab-select="#tab-select">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-responsive-item-1"data-tab="#tabs-responsive-1"aria-controls="tabs-responsive-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-responsive-item-2"data-tab="#tabs-responsive-2"aria-controls="tabs-responsive-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-responsive-item-3"data-tab="#tabs-responsive-3"aria-controls="tabs-responsive-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-responsive-1"role="tabpanel"aria-labelledby="tabs-responsive-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-responsive-2"class="hidden"role="tabpanel"aria-labelledby="tabs-responsive-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-responsive-3"class="hidden"role="tabpanel"aria-labelledby="tabs-responsive-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs bg-base-200 rounded-field w-fit space-x-1 overflow-x-auto p-1"aria-label="Tabs"role="tablist"aria-orientation="horizontal" >
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary active hover:bg-transparent"id="tabs-segment-item-1"data-tab="#tabs-segment-1"aria-controls="tabs-segment-1"role="tab"aria-selected="true" >
Home
</button>
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-transparent"id="tabs-segment-item-2"data-tab="#tabs-segment-2"aria-controls="tabs-segment-2"role="tab"aria-selected="false" >
Profile
</button>
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-transparent"id="tabs-segment-item-3"data-tab="#tabs-segment-3"aria-controls="tabs-segment-3"role="tab"aria-selected="false" >
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-segment-1"role="tabpanel"aria-labelledby="tabs-segment-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-segment-2"class="hidden"role="tabpanel"aria-labelledby="tabs-segment-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-segment-3"class="hidden"role="tabpanel"aria-labelledby="tabs-segment-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Use component classes btn and btn-text to style pills with a button-like appearance.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs space-x-1 overflow-x-auto"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary active hover:bg-primary/20"id="tabs-pill-item-1"data-tab="#tabs-pill-1"aria-controls="tabs-pill-1"role="tab">
Home
</button>
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-primary/20"id="tabs-pill-item-2"data-tab="#tabs-pill-2"aria-controls="tabs-pill-2"role="tab">
Profile
</button>
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-primary/20"id="tabs-pill-item-3"data-tab="#tabs-pill-3"aria-controls="tabs-pill-3"role="tab">
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-pill-1"role="tabpanel"aria-labelledby="tabs-pill-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-pill-2"class="hidden"role="tabpanel"aria-labelledby="tabs-pill-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-pill-3"class="hidden"role="tabpanel"aria-labelledby="tabs-pill-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs overflow-x-auto space-x-1 p-1"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary active hover:bg-primary/20"id="tabs-pill-icon-item-1"data-tab="#tabs-pill-icon-1"aria-controls="tabs-pill-icon-1"role="tab"aria-selected="false">
<spanclass="icon-[tabler--home] size-5 shrink-0"></span>
<spanclass="hidden sm:inline">Home</span>
</button>
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-primary/20"id="tabs-pill-icon-item-2"data-tab="#tabs-pill-icon-2"aria-controls="tabs-pill-icon-2"role="tab"aria-selected="false">
<spanclass="icon-[tabler--user] size-5 shrink-0"></span>
<spanclass="hidden sm:inline">Profile</span>
</button>
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-primary/20"id="tabs-pill-icon-item-3"data-tab="#tabs-pill-icon-3"aria-controls="tabs-pill-icon-3"role="tab"aria-selected="false">
<spanclass="icon-[tabler--message] size-5 shrink-0"></span>
<spanclass="hidden sm:inline">Messages<span>
</button>
</nav>
<divclass="mt-3">
<divid="tabs-pill-icon-1"role="tabpanel"aria-labelledby="tabs-pill-icon-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-pill-icon-2"class="hidden"role="tabpanel"aria-labelledby="tabs-pill-icon-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-pill-icon-3"class="hidden"role="tabpanel"aria-labelledby="tabs-pill-icon-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs space-x-1 overflow-x-auto"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="grow btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary active hover:bg-primary/20"id="tabs-fill-item-1"data-tab="#tabs-fill-1"aria-controls="tabs-fill-1"role="tab"aria-selected="false">
Home
</button>
<buttontype="button"class="grow btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-primary/20"id="tabs-fill-item-2"data-tab="#tabs-fill-2"aria-controls="tabs-fill-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="grow btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-primary/20"id="tabs-fill-item-3"data-tab="#tabs-fill-3"aria-controls="tabs-fill-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-fill-1"role="tabpanel"aria-labelledby="tabs-fill-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-fill-2"class="hidden"role="tabpanel"aria-labelledby="tabs-fill-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-fill-3"class="hidden"role="tabpanel"aria-labelledby="tabs-fill-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
For tabs styled with the tabs-vertical class and pills styled with Tailwind classes, please make sure they are distinct and not linked.
For keyboard accessibility to function properly, please set data-attribute data-tabs-vertical to true.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<divclass="flex">
<navclass="tabs flex-col items-start space-y-1"aria-label="Tabs"role="tablist"data-tabs-vertical="true"aria-orientation="horizontal" >
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-primary/20 active w-full"id="tabs-pill-vertical-item-1"data-tab="#tabs-pill-vertical-1"aria-controls="tabs-pill-vertical-1"role="tab"aria-selected="true" >
Home
</button>
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-primary/20 w-full"id="tabs-pill-vertical-item-2"data-tab="#tabs-pill-vertical-2"aria-controls="tabs-pill-vertical-2"role="tab"aria-selected="false" >
Profile
</button>
<buttontype="button"class="btn btn-text active-tab:bg-primary active-tab:text-white hover:text-primary hover:bg-primary/20 w-full"id="tabs-pill-vertical-item-3"data-tab="#tabs-pill-vertical-3"aria-controls="tabs-pill-vertical-3"role="tab"aria-selected="false" >
Messages
</button>
</nav>
<divclass="ms-3">
<divid="tabs-pill-vertical-1"role="tabpanel"aria-labelledby="tabs-pill-vertical-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-pill-vertical-2"class="hidden"role="tabpanel"aria-labelledby="tabs-pill-vertical-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-pill-vertical-3"class="hidden"role="tabpanel"aria-labelledby="tabs-pill-vertical-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
</div>
Below is a demonstration illustrating how to use the public methods. It might seem a bit complex because the open() method requires the ID of the button with role="tab" and data-tab="tabpanel-id", rather than just the tabpanel-id.
In the example below, we’ve provided the ID tabs-method-3 and added an event listener to the openBtn.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered"aria-label="Tabs"role="tablist"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-method-item-1"data-tab="#tabs-method-1"aria-controls="tabs-method-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-method-item-2"data-tab="#tabs-method-2"aria-controls="tabs-method-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-method-item-3"data-tab="#tabs-method-3"aria-controls="tabs-method-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-method-1"role="tabpanel"aria-labelledby="tabs-method-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-method-2"class="hidden"role="tabpanel"aria-labelledby="tabs-method-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-method-3"class="hidden"role="tabpanel"aria-labelledby="tabs-method-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
<buttontype="button"class="btn btn-primary mt-3"id="open-btn"> Messages </button>
// This method is used in above example.
constopenBtn= document.querySelector('#open-btn');
openBtn.addEventListener('click', () => {
HSTabs.open(document.querySelector('#tabs-method-item-3'))
});
Below, is the demonstration on how to use the event. Apply the ID to the role=tablist component class. To test these event, copy the following event into your console and click the button.
Welcome to the Home tab! Explore the latest updates and news here.
This is your Profile tab, where you can update your personal information and manage your account details.
Messages: View your recent messages, chat with friends, and manage your conversations.
<navclass="tabs tabs-bordered"aria-label="Tabs"role="tablist"id="tabs-event"aria-orientation="horizontal">
<buttontype="button"class="tab active-tab:tab-active active"id="tabs-event-item-1"data-tab="#tabs-event-1"aria-controls="tabs-event-1"role="tab"aria-selected="true">
Home
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-event-item-2"data-tab="#tabs-event-2"aria-controls="tabs-event-2"role="tab"aria-selected="false">
Profile
</button>
<buttontype="button"class="tab active-tab:tab-active"id="tabs-event-item-3"data-tab="#tabs-event-3"aria-controls="tabs-event-3"role="tab"aria-selected="false">
Messages
</button>
</nav>
<divclass="mt-3">
<divid="tabs-event-1"role="tabpanel"aria-labelledby="tabs-event-item-1">
<pclass="text-base-content/80">
Welcome to the <spanclass="text-base-content font-semibold">Home tab!</span> Explore the latest updates and news here.
</p>
</div>
<divid="tabs-event-2"class="hidden"role="tabpanel"aria-labelledby="tabs-event-item-2">
<pclass="text-base-content/80">
This is your <spanclass="text-base-content font-semibold">Profile</span> tab, where you can update your personal information and manage your account details.
</p>
</div>
<divid="tabs-event-3"class="hidden"role="tabpanel"aria-labelledby="tabs-event-item-3">
<pclass="text-base-content/80">
<spanclass="text-base-content font-semibold">Messages:</span> View your recent messages, chat with friends, and manage your conversations.
</p>
</div>
</div>
<script>
window.addEventListener('load', function () {
constel=HSTabs.getInstance('#tabs-event')
el.on('change', ({ el, prev, current }) => {
console.log('el', el)
console.log('prev', prev)
console.log('current', current)
})
})
</script>
constel=HSTabs.getInstance('#tabs-event');
el.on('change', ({ el, prev, current }) => {
console.log('el', el)
console.log('prev', prev)
console.log('current', current)
})