Skip to content

Vertical Tabs

Bootstrap 5 vertical nav-pills tabs styled as a settings panel with a dark sidebar, icons, fading content panes and a scrollable mobile tab strip.

Live preview

Open in new tab

Code

A Bootstrap 5 vertical tabs component built from nav-pills, styled as a project settings panel with a dark indigo sidebar and a lime active pill. Use it for account settings, dashboards, documentation sections or any place where several related panels share one card.

How it works

The root section.vt-tabs holds a rounded .vt-shell card split into two Bootstrap columns. The left .vt-side column contains the .vt-nav pill list: four button.nav-link elements with data-bs-toggle="pill" and a data-bs-target that points to a matching .tab-pane. The right column holds the .tab-content.vt-content container with the General, Team, Notifications and Billing panes.

There is no custom JavaScript. Bootstrap's Tab plugin, loaded with the bundle, switches the active class, updates aria-selected, moves tabindex and fades the panes in with the fade and show classes.

The layout is mobile first. Below 768px the nav uses flex-row and .vt-nav scrolls horizontally with overflow-x: auto, so the pills sit above the content as a scrollable strip. From the md breakpoint flex-md-column stacks them vertically and the sidebar fills the full card height. The panes show typical settings content: a definition list (.vt-list), a member list with initials avatars (.vt-members, .vt-avatar), switch toggles and a plan box (.vt-plan).

Customization

  • --vt-side-bg in .vt-tabs: changes the sidebar color, avatars, checked switches and the .vt-btn button in one place.
  • --vt-accent and --vt-accent-text in .vt-tabs: set the background and text color of the active pill and the small "Workspace" eyebrow.
  • --vt-radius in .vt-tabs: makes the outer card corners sharper or rounder.
  • col-md-4 col-lg-3 on .vt-side: widen or narrow the sidebar; adjust the content column (col-md-8 col-lg-9) to match.
  • Add a tab by copying a button.nav-link and a .tab-pane, then give both new ids and point data-bs-target and aria-controls at the pane.
  • Remove fade from each .tab-pane to switch panels instantly instead of fading.
  • .vt-count badge in the Team tab: remove it or use it to show counts on other tabs.

Accessibility

The nav has role="tablist" and aria-orientation="vertical", each button has role="tab", aria-controls and aria-selected, and each pane has role="tabpanel" with aria-labelledby pointing to its tab. Bootstrap handles roving tabindex and arrow keys (Up/Down and Left/Right) plus Home and End between tabs. Tabs and panes show a clear :focus-visible outline, icons are hidden with aria-hidden="true", and initials avatars are hidden because the name is already readable. Fades and color transitions are turned off under prefers-reduced-motion: reduce.

Usage notes

Requires the Bootstrap 5 bundle (added automatically) and Bootstrap Icons. When you place two instances on one page, give the tabs and panes unique ids, because data-bs-target and aria-controls refer to ids.

Requirements

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

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/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">
Vertical Tabs – Bootstrap 5 tabs component screenshot
Vertical Tabs · Bootstrap 5 Tabs

More Tabs

Animated Pill Tabs – Pure CSS tabs preview

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.

Underline Tabs – Tailwind CSS tabs preview

Underline Tabs

Accessible Tailwind CSS tabs with a sliding underline indicator, arrow-key and Home/End navigation, count badge and scrollable tab bar on mobile.