Skip to content

Bottom Navigation with Floating Indicator

Tailwind CSS mobile tab bar with a gradient bubble that floats above the bar and slides to the active icon, with keyboard support.

Also known as: mobile tab bar, bottom tab navigation, animated bottom menu, floating bubble navigation, app bottom navigation bar

Bottom Navigation with Floating Indicator live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

A mobile bottom navigation bar built with Tailwind CSS and a few lines of vanilla JavaScript. A gradient bubble floats above the dark tab bar and slides with a springy motion to whichever tab you pick, while the active icon jumps up into it. It is shown in a phone frame, but the bar fits any mobile web app or PWA.

How it works

The root is .bnf-app, a phone-sized screen with the content area and an absolutely positioned nav. Inside the nav, .bnf-bar holds the round .bnf-indicator and the .bnf-list tab list with five .bnf-tab buttons. Each tab has an icon (.bnf-icon), a label (.bnf-label) and aria-controls pointing to its .bnf-panel.

On DOMContentLoaded the script initializes every .bnf-app on the page. It reads the tab marked aria-selected="true", shows its panel, hides the others and centers the bubble under it by writing the --bnf-x custom property from the tab's offsetLeft and width. The first placement uses the bnf-instant class so the bubble does not fly in; after that bnf-ready fades it in and every move uses the overshooting cubic-bezier(0.34, 1.56, 0.64, 1) transition from style.css. A ResizeObserver on the bar re-centers the bubble when the width changes.

The floating look comes from --bnf-lift, which raises the bubble above the bar, and a 6 px ring in the screen color (ring-[#f6f4fb]) that cuts a notch into the bar. The active tab's icon is moved up with transform so it sits in the bubble.

Customization

  • --bnf-lift on .bnf-indicator in style.css: use -1.4rem for a lower bubble or 0 to keep it inside the bar.
  • from-violet-500 to-orange-400 on .bnf-indicator: change the bubble gradient, for example to from-sky-500 to-emerald-400.
  • ring-[#f6f4fb] on .bnf-indicator and bg-[#f6f4fb] on .bnf-app: keep both the same color so the notch blends into the screen.
  • bg-slate-900 on .bnf-bar: switch to bg-white and set text-slate-500 on the tabs for a light bar.
  • grid-cols-5 on .bnf-list: match it to the number of .bnf-tab buttons (3 to 5 works best).
  • Move aria-selected="true" (and remove tabindex="-1") to another tab to change the tab that opens first.
  • translateY(-1.6rem) in the .bnf-tab[aria-selected="true"] .bnf-icon rule: adjust it together with --bnf-lift to keep the icon centered in the bubble.

Use cases

  • Mobile web apps: five tabs sit at the bottom with a bubble that slides to the active icon
  • Progressive web apps: a thumb-friendly dark bar replaces a top menu on phones
  • Dashboard apps: each tab switches a panel, with arrow keys, Home and End also supported
  • Prototypes and demos: shown in a phone frame to preview how a mobile app navigation feels

Accessibility

The bar is a nav with aria-label="Main" and a role="tablist". Each button has role="tab", aria-selected and aria-controls, and every panel has role="tabpanel" with aria-labelledby. Only the active tab is in the Tab order; Arrow Left/Right, Home and End move between tabs and activate them. Icons are aria-hidden and every tab has a visible text label. Tabs and panels show a violet focus outline, and all transitions and the panel fade are disabled under prefers-reduced-motion: reduce.

Usage notes

For page links instead of panels, replace the buttons with links, drop the tab roles and mark the active one with aria-current="page". For several instances, give each tab and panel unique id values. On a real site, use fixed instead of absolute on the nav.

Bottom Navigation with Floating Indicator at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile
Category
Bottom Navigation
License
Free for personal and commercial use

Questions about this template

Can I use the Bottom Navigation with Floating Indicator 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 Tailwind CSS 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):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Bottom Navigation with Floating Indicator – free Tailwind CSS bottom navigation template
Bottom Navigation with Floating Indicator · free Tailwind CSS bottom navigation template

More Bottom Navigation

Bottom Navigation Bar with Badges – free Bootstrap 5 bottom navigation template

Bottom Navigation Bar with Badges

Fixed Bootstrap 5 mobile bottom navigation with icons, labels, notification badges, a 9+ overflow badge and a floating pill on desktop.

Mobile Bottom Tab Bar – free Tailwind CSS bottom navigation template

Mobile Bottom Tab Bar

Fixed Tailwind CSS bottom tab bar with icons, labels, an active pill, an unread badge, safe-area padding and optional hide-on-scroll.