Skip to content

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.

Also known as: icon tab navigation, icon tabs, tabbed navigation with badges, project tabs, tab navigation with counts

Bootstrap 6 Tabs Responsive #card #icons #nav #responsive #tabs

Tabs with Icons live demo

Open in new tab

Bootstrap 6 code (HTML, CSS)

Bootstrap 6 nav tabs with an icon in front of every label, inside a clean project card. The active tab gets a blue top bar and a filled version of its icon, and two tabs carry count badges. The panels (Overview, Activity, Files, Team and Settings) fade in when you switch. It works without any custom JavaScript.

How it works

The tab list is a regular ul.nav.nav-tabs with role="tablist". Each button.nav-link has data-bs-toggle="tab", a data-bs-target pointing at its panel, role="tab", aria-controls and aria-selected. The panels are .tab-pane elements inside .tab-content, and the first one starts as tab-pane show active. Bootstrap 6's Tab plugin switches them through the data API and moves tabindex and aria-selected for you. Panels fade by default in Bootstrap 6, so the BS5 .fade class is not needed.

Every tab holds two Bootstrap Icons: an outline .twi-ico and a filled .twi-ico-on. CSS shows the filled one only inside .nav-link.active, so the icon changes with no script. Counts sit in .twi-count pills that turn blue on the active tab. A ::before bar on the active link draws the top accent line. The tab bar uses flex-wrap: nowrap and overflow-x: auto, so on phones it scrolls sideways instead of wrapping.

The panels show common card content: stat tiles with a Bootstrap .progress, an activity feed, a flush .list-group of files, .avatar initials for the team and Bootstrap 6 .switch toggles inside .form-field for settings.

Customization

  • --twi-brand and --twi-brand-soft on .twi-root: change the active tab color, the top accent bar, badges and progress bar.
  • --twi-page, --twi-card and --twi-line on .twi-root: adjust the page tint, card surface and borders.
  • --bs-nav-link-padding-x and --bs-nav-link-padding-y on .twi-tabs: make tabs roomier or more compact.
  • Swap the icon pairs in each tab (for example bi-bell and bi-bell-fill) to match your sections.
  • Add tab-pane-instant to a .tab-pane to switch it without the fade.
  • min-height on .twi-content: keeps the card from jumping in height between short and long panels.

Use cases

  • Project and task pages: tabs with outline icons switch between overview, tasks and files
  • Dashboards: count badges on tabs show how many items each section holds
  • Profile and detail pages: filled icons mark the active tab and panels fade in
  • Keyboard-friendly interfaces: arrow keys move focus between the tabs without using the mouse

Accessibility

The markup follows the ARIA tabs pattern: tablist, tab and tabpanel roles, aria-controls, aria-labelledby and aria-selected. The Tab plugin adds roving tabindex, so Tab moves into the tab list once, Left and Right arrows (and Home and End) switch tabs, and Tab again moves into the focusable panel. Icons are aria-hidden. The count pills are hidden from screen readers and replaced by visually hidden text such as ", 3 new". Tabs have a visible blue focus outline. The fade is a short opacity change that Bootstrap disables under prefers-reduced-motion.

Bootstrap 6 notes

The tab markup is the same as Bootstrap 5, but .fade is no longer needed because panels fade by default. Switches are now <div class="switch"> with role="switch" instead of .form-check.form-switch, and avatars, badge-subtle theme-success and progress follow the new theme roles. Built on Bootstrap 6.0.0-alpha.1, so alpha APIs can still change. Icons come from Bootstrap Icons.

Tabs with Icons at a glance

Framework
Bootstrap 6
Code
HTML, CSS
JavaScript
Only Bootstrap 6's own script
Dependencies
Bootstrap 6, Bootstrap Icons
Layout
Responsive, works on mobile
Category
Tabs
License
Free for personal and commercial use

Questions about this template

Can I use the Tabs with Icons 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 and add the CSS to your stylesheet. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. Only Bootstrap 6's own JavaScript is used, and the download already includes it.

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.

Tabs with Icons – free Bootstrap 6 tabs template
Tabs with Icons · free Bootstrap 6 tabs template

More Tabs

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.

Vertical Tabs – free Bootstrap 5 tabs template

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.

Underline Tabs – free Tailwind CSS tabs template

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.