Navbar With Floating Pill

Pro

Dark floating pill that centers at the top of the viewport with backdrop blur, gradient CTA, and hover spring animations. Adapts to light and dark mode automatically.

When to use Navbar With Floating Pill

Pulls away from the top edge and floats as a rounded capsule with the page visible around it. It reads lighter than a bar that spans the full width, and it gives a tall hero back the strip of vertical space a conventional header would have taken. The gradient call to action is the anchor at its right end.

The failure case is specific and worth checking before you commit. Because the pill is narrow and blurred rather than opaque, whatever scrolls beneath it shows through, and over a photograph the contrast behind the link labels changes as the page moves. Over a flat colour or a slow gradient it holds up fine. Scroll your real hero underneath it once and you will know within seconds which situation you are in.

Block details

Category
Navbars
Renders
JavaScript animation. Paints first, then animates
Theme
Follows the site theme in light and dark
Responsive
Mobile, tablet and desktop breakpoints are already set
Dependencies
clsxframer-motiontailwind-merge
Source
160 lines, 6 KB in one file
Install
wensity add navbar-with-floating-pill --type block
Stack
React, Next.js, TypeScript and Tailwind CSS v4
Licence
Included with Wensity Pro. The CLI copies the file into your repository and you own it from there
Tags
light, dark, floating, pill, glass
Last updated

More navbars