FINDING YOUR DIRECTION

0%

UI components / Navigation

Floating Navbar: a React and Tailwind UI component

A glass pill nav that hides on scroll down and returns on scroll up.

Floating Navbar component preview

Open the live Floating Navbar preview.

An animated navbar for a compact site header

Use this floating navigation bar when a page needs a compact header that moves out of the way on downward scrolling and returns as the visitor scrolls up. The demo listens to its own scroll panel; your page can use the window or pass a scroll container.

Integration and launch checks

The exported FloatingNavbar accepts links, an optional CTA and an optional scroller ref. Replace the demo logo and anchor targets. Supply real destinations and keep the header inside a layout where sticky positioning can work. This is React + Tailwind source, not a standalone HTML navbar.

Related guides

About navigation components

Navigation components need to be predictable above all. Motion should show where you are and where you are going, every item must be reachable by keyboard, and the current page should be marked with aria-current.

Install the Floating Navbar

  1. Create components/ui/floating-navbar.tsx in your React + Tailwind project.
  2. Paste the code. It only imports React; keyframes are defined inside the file.
  3. Import the named component where you need it. The default export is a ready-made demo you can delete.

Frequently asked questions

Is the Floating Navbar component free?

Anyone can open the live preview. Copying the code is included with a Scrollhaus plan.

What do I need to use it?

A React project with Tailwind CSS: Next.js, Vite, Lovable or Bolt. The file only imports React; its animations ship inside the component.

Is it accessible?

Treat this as an implementation starting point. Follow the integration and launch checks below, including keyboard focus, mobile layout and reduced-motion behaviour, and test the component in your app.

More navigation

Browse all 49 UI components · Compare with 21st.dev