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.navoverflowandupdate.bs.navoverflow,syncMenu()removes the tab attributes from the copied menu items and stores the target indata-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 getsaria-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-accenton.sto-root: changes the active underline, logo tile, chart bars, switch and the selected menu item.--sto-bg,--sto-surface,--sto-raisedand--sto-lineon.sto-root: adjust the dark surfaces and borders.max-width: 52remon.sto-shell: a wider shell shows more tabs before the More menu appears.data-bs-more-texton.sto-overflow: renames the More button, andfalseshows only the dots icon.- Add
nav-overflow-keepto anav-itemto keep that tab visible at every width. - Add
data-bs-collapse-below="md"to.sto-overflowto 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.