Liquid glass navbar in React and Tailwind for 2027

Build an Apple-style liquid glass navbar in React: a frosted pill that blurs and brightens what scrolls under it, a lit rim, and a glass lens that glides under the hovered link with Motion.

5 min read

The real component. Click the picture to open it live and try it before you read how it was built.

Apple's liquid glass made frosted, lens-like interfaces the look people search for. Here is a navbar that does it with plain CSS and one shared layout animation.

Frosting and a lit rim

The pill uses backdrop blur and a touch of saturation so whatever scrolls beneath it turns into a soft sheen, plus a bright hairline along the top edge, like light catching the rim of glass.

A smaller glass lens glides under whichever link is hovered or focused. It is one element with a shared layoutId, so Motion animates it from link to link on a spring instead of fading one out and another in.

src/registry/navbars/glass/navbar-glass.tsx

"use client";

import { useState, type ReactNode } from "react";
import { AnimatePresence, MotionConfig, motion } from "motion/react";
import { MenuToggle } from "@/registry/navbars/shared/menu-toggle";
import { NavCtaLink } from "@/registry/navbars/shared/nav-cta-link";
import { NavLinkList } from "@/registry/navbars/shared/nav-link-list";
import { NavMobilePanel } from "@/registry/navbars/shared/nav-mobile-panel";
import { SPRING_SOFT } from "@/lib/motion";
import { cn } from "@/lib/utils";
import type { NavCta, NavItem } from "@/registry/navbars/shared/types";

export interface NavbarGlassProps {
  logo: ReactNode;
  items: NavItem[];
  cta?: NavCta;
  className?: string;
}

// Liquid glass, as on Apple's latest interfaces: a frosted pill that blurs and brightens whatever
// scrolls beneath it, with a lit rim, and a smaller glass lens that glides under the hovered link.
export function NavbarGlass({ logo, items, cta, className }: NavbarGlassProps) {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <MotionConfig reducedMotion="user">
      <header className={cn("fixed inset-x-0 top-4 z-50 flex justify-center px-3", className)}>
        <motion.nav
          aria-label="Main"
          initial={{ opacity: 0, y: -16, filter: "blur(8px)" }}
          animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
          transition={SPRING_SOFT}
          className="relative w-full max-w-3xl overflow-hidden rounded-4xl border border-white/60 bg-white/25 shadow-glass backdrop-blur-2xl backdrop-saturate-200"
        >
          <span
            aria-hidden
            className="absolute inset-x-10 top-0 h-px bg-linear-to-r from-transparent via-white to-transparent"
          />
          <div className="flex h-14 items-center justify-between gap-3 pr-2 pl-5">
            <a href="#top" aria-label="Home" className="text-ink">
              {logo}
            </a>
            <NavLinkList
              items={items}
              delay={0.2}
              className="hidden md:flex"
              linkClassName="h-9 px-3.5 text-ink/70 hover:text-ink focus-visible:text-ink"
              activeLinkClassName="text-ink"
              indicatorClassName="inset-0 rounded-full border border-white/70 bg-white/55 shadow-glass"
            />
            <div className="flex items-center gap-1">
              {cta && <NavCtaLink cta={cta} variant="brand" size="sm" className="hidden h-9 px-4 md:inline-flex" />}
              <MenuToggle isOpen={isOpen} onToggle={() => setIsOpen((open) => !open)} className="text-ink md:hidden" />
            </div>
          </div>
          <AnimatePresence initial={false}>
            {isOpen && <NavMobilePanel items={items} cta={cta} onNavigate={() => setIsOpen(false)} />}
          </AnimatePresence>
        </motion.nav>
      </header>
    </MotionConfig>
  );
}
The navbar

Glass needs something behind it

Frosting a white page shows nothing, so the demo sits the bar over a painted evening sky. In your site, put it over imagery or colour.

More articles