StealThis .dev

Bottom Navigation

Mobile-style bottom navigation bar with icon + label, active state, badge counter, and slide-up indicator.

Open in Lab
css vanilla-js
Targets: JS HTML

Code

Bottom Navigation

A mobile-first bottom navigation bar with icon + label tabs, animated active indicator, and badge counter. No dependencies.

Features

  • Five-tab layout: Home, Search, Add, Notifications, Profile
  • Smooth slide-up active indicator bar
  • Badge counter on the Notifications tab
  • Active state toggled via JS on click
  • Fully keyboard-accessible with role="tablist" and aria-selected

How it works

  1. Each tab is a <button> with role="tab" and aria-selected
  2. The active indicator is a CSS ::after pseudo-element that transitions horizontally to align with the active tab
  3. JS updates aria-selected and the --active-index CSS custom property on the :root so the indicator slides to the correct position
  4. The Add tab uses a raised circular style to stand out as the primary action

Accessibility

Uses role="tablist" on the nav container, role="tab" on each item, and aria-selected to communicate state to assistive technologies.