--- title: Tab summary: A tab allows users to alternate between equally important views within the same context. By dividing content into meaningful sections, it improves organization and makes navigation easier. description: Split content into tabs so users can switch between related views in the same context. Add icons or style the tabs as pills. related: [/ui/layout/navs-tabs] source: core/scss/ui/_nav.scss classnames: component: - class: nav-tabs desc: Applied with nav, styles the triggers as tabs part: - class: nav-link desc: One tab trigger; needs role="tab" and aria-controls - class: tab-content desc: Wrapper around the panels - class: tab-pane desc: One panel; needs role="tabpanel" style: - class: nav-underline desc: Underline marker instead of a filled tab - class: nav-bordered desc: Bordered tab style modifier: - class: nav-fill desc: Spreads the tabs across the full width --- import Example from '@components/Example.astro'; import Icon from '@ui/Icon.astro'; import CodeDocs from '@components/CodeDocs.astro'; ## Default markup Use tabs to let users access different sections within one context quickly and with ease. In the default design, the current tab is highlighted, which makes the interface clear and user-friendly.

Home tab

Cursus turpis vestibulum, dui in pharetra vulputate id sed non turpis ultricies fringilla at sed facilisis lacus pellentesque purus nibh

Profile tab

Fringilla egestas nunc quis tellus diam rhoncus ultricies tristique enim at diam, sem nunc amet, pellentesque id egestas velit sed
## Tabs with icons Add [icons](/ui/components/icon) to your tab labels, if you want to use a visual element and make the tab content easier to identify.

Home tab

Cursus turpis vestibulum, dui in pharetra vulputate id sed non turpis ultricies fringilla at sed facilisis lacus pellentesque purus nibh

Profile tab

Fringilla egestas nunc quis tellus diam rhoncus ultricies tristique enim at diam, sem nunc amet, pellentesque id egestas velit sed

Settings tab

Donec ac vitae diam amet vel leo egestas consequat rhoncus in luctus amet, facilisi sit mauris accumsan nibh habitant senectus
## Tabs only with icons Use tabs without label names to save space and make the tab content easy to recognize for international users.

Home tab

Cursus turpis vestibulum, dui in pharetra vulputate id sed non turpis ultricies fringilla at sed facilisis lacus pellentesque purus nibh

Profile tab

Fringilla egestas nunc quis tellus diam rhoncus ultricies tristique enim at diam, sem nunc amet, pellentesque id egestas velit sed

Settings tab

Donec ac vitae diam amet vel leo egestas consequat rhoncus in luctus amet, facilisi sit mauris accumsan nibh habitant senectus
## Tabs with dropdown Make one or more of your tabs into a [dropdown](/ui/components/dropdown) to add more options within one element.

Home tab

Cursus turpis vestibulum, dui in pharetra vulputate id sed non turpis ultricies fringilla at sed facilisis lacus pellentesque purus nibh

Profile tab

Fringilla egestas nunc quis tellus diam rhoncus ultricies tristique enim at diam, sem nunc amet, pellentesque id egestas velit sed
## Full-width tabs Add the `.nav-fill` class to make the tabs take up the full space of the parent element.

Home tab

Cursus turpis vestibulum, dui in pharetra vulputate id sed non turpis ultricies fringilla at sed facilisis lacus pellentesque purus nibh

Profile tab

Fringilla egestas nunc quis tellus diam rhoncus ultricies tristique enim at diam, sem nunc amet, pellentesque id egestas velit sed

Activity tab

Donec ac vitae diam amet vel leo egestas consequat rhoncus in luctus amet, facilisi sit mauris accumsan nibh habitant senectus
## JavaScript Tabler activates the tab that matches the URL hash on page load, so you can link to a specific tab. This is the code that runs: ## Accessibility - Wrap the tabs in an element with `role="tablist"`, give each trigger `role="tab"` and each panel `role="tabpanel"`, and link them with `aria-controls` and `aria-labelledby`. - Bootstrap sets `aria-selected` and moves focus with the arrow keys, but only when the roles above are present. Without them the tabs are plain links. - Tabler activates a tab from the url hash on page load, so a tab trigger with `href="#billing"` doubles as a deep link. Keep the panel ids stable if you link to them. - Only the active panel should be reachable. Bootstrap hides the others with `display: none`, which also removes them from the tab order.