Skip to content

Scrollable Tabs with Overflow

Dark Bootstrap 6 underline tabs using NavOverflow: tabs that do not fit move into a More menu that still selects the right pane.

Also known as: scrollable tabs, tabs overflow menu, tabs with more menu, responsive tabs, underline tabs

Bootstrap 6 Tabs Responsive Dark #dark #navigation #overflow #responsive #tabs

Scrollable Tabs with Overflow live demo

Open in new tab

Bootstrap 6 code (HTML, CSS, JS)

A dark repository-style tab bar built with Bootstrap 6's new NavOverflow component. Nine underline tabs sit in one row, and the tabs that do not fit the width move into a "More" menu instead of wrapping or forcing a sideways scroll. Use it for project dashboards, admin areas or any page with more sections than the header has room for.

How it works

The tab list is a ul.nav.nav-underline.sto-tabs with role="tablist", wrapped in .sto-overflow with data-bs-toggle="nav-overflow" and data-bs-more-text="More". NavOverflow measures the wrapper, not the viewport. It hides the tabs that overflow (they get data-bs-nav-overflow) and copies them into an auto-generated .nav-overflow-menu, which is a Bootstrap 6 Menu. Each tab is a normal Tab trigger with data-bs-toggle="tab" and data-bs-target, so the panes in .tab-content switch through the data API.

script.js connects the two plugins:

  • On overflow.bs.navoverflow and update.bs.navoverflow, syncMenu() removes the tab attributes from the copied menu items and stores the target in data-sto-target. The Tab plugin then ignores the copies.
  • A click on a menu item calls Tab.getOrCreateInstance(tab).show() on the hidden original tab.
  • When the selected tab sits in the menu, the More toggle gets .sto-more--current (underlined like an active tab) and the menu item gets aria-current.
  • A keydown listener in the capture phase limits arrow keys, Home and End to the visible tabs.
  • On load, NavOverflow.getOrCreateInstance(...).update() measures again once the icon font is in.

Customization

  • --sto-accent on .sto-root: changes the active underline, logo tile, chart bars, switch and the selected menu item.
  • --sto-bg, --sto-surface, --sto-raised and --sto-line on .sto-root: adjust the dark surfaces and borders.
  • max-width: 52rem on .sto-shell: a wider shell shows more tabs before the More menu appears.
  • data-bs-more-text on .sto-overflow: renames the More button, and false shows only the dots icon.
  • Add nav-overflow-keep to a nav-item to keep that tab visible at every width.
  • Add data-bs-collapse-below="md" to .sto-overflow to move every tab into the menu on small screens.

Use cases

  • Dashboards with many sections: tabs that do not fit move into a More menu
  • Narrow containers: the overflow menu still selects the right pane
  • Settings and reports pages: underline tabs keep a dark layout clean and readable
  • Responsive apps: tabs adapt to the width instead of wrapping onto several lines

Accessibility

The strip is a real tablist with aria-selected and roving tabindex, and each pane is a focusable tabpanel labelled by its tab. The More button is a Menu toggle with aria-expanded, and its items are plain buttons that also work by keyboard. Counters are text inside the tab, so screen readers read "Issues 24". The chart has a heading and visually hidden values for each bar. Focus outlines use the accent color on the dark surface.

Bootstrap 6 notes

Bootstrap 5 had no priority+ navigation. NavOverflow is new in Bootstrap 6, and it builds its More menu from the new Menu component, which replaces .dropdown-menu. The tabs use nav-underline, which BS6 keeps, and badges use badge-subtle theme-*. data-bs-theme="dark" on the root keeps the design dark in both color modes. Built on Bootstrap 6.0.0-alpha.1, so APIs may still change. Icons come from Bootstrap Icons.

Scrollable Tabs with Overflow at a glance

Framework
Bootstrap 6
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 6, Bootstrap Icons
Layout
Responsive, works on mobile, dark design
Category
Tabs
License
Free for personal and commercial use

Questions about this template

Can I use the Scrollable Tabs with Overflow code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 6 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/css/bootstrap.min.css">
  • <script type="module" src="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">

Built for Bootstrap 6.0.0-alpha.1. Bootstrap 6 ships as an ES module, so its script and this component's JavaScript load with type="module". Alpha releases can still change before the stable version.

Scrollable Tabs with Overflow – free Bootstrap 6 tabs template
Scrollable Tabs with Overflow · free Bootstrap 6 tabs template

More Tabs

Vertical Pills Tabs – free Bootstrap 6 tabs template

Vertical Pills Tabs

Bootstrap 6 settings panel with vertical icon pills that switch between five content panes, turning into a scrollable pill strip on phones.

Tabs with Icons – free Bootstrap 6 tabs template

Tabs with Icons

Bootstrap 6 nav tabs with outline icons that turn filled when active, count badges, fading panels and arrow-key navigation, in a project card.

Radio Button Tabs Without JavaScript – free Pure CSS tabs template

Radio Button Tabs Without JavaScript

Accessible CSS-only tabs built from radio inputs and the :checked selector, with a sliding pill indicator and fading panels. No JavaScript.

Scrollable Tabs for Mobile – free Bootstrap 5 tabs template

Scrollable Tabs for Mobile

Bootstrap 5 tabs that scroll horizontally on small screens, with fade edges, arrow buttons, scroll snapping and the active tab centered automatically.

Tabs with Photo Preview Panels – free Tailwind CSS tabs template

Tabs with Photo Preview Panels

Tailwind CSS feature tabs that swap a large photo preview with a caption for each selected tab, with full keyboard support.

Animated Pill Tabs – free Pure CSS tabs template

Animated Pill Tabs

Segmented pill tabs with a sliding, springy background, ARIA tabs keyboard support and fading panels, shown on an analytics card. Pure CSS and vanilla JS.