Sticky Sub-Nav Pills

About this block

Sticky Sub-Nav PillsPRO

A main bar of brand, links and a button stacked over a second sticky row of section pills, where a filled indicator slides to the pill you click with a shared framer-motion layout. There is no mega menu; on a phone the toggle reveals the main links as one horizontally scrollable pill row, and the section pills scroll sideways too. The mobile row stays in the markup and is toggled with CSS.

A main bar with the brand, links and a button, stacked over a second sticky row of section pills for the current page. Clicking a pill slides a filled indicator under it with a shared framer-motion layout. There is no mega menu: on a phone the toggle reveals the main links as one horizontally scrollable row of pills, and the section pills scroll sideways as well.

Upgrade to Pro

Pro blocks install through the shadcn CLI with your license key and ship their full source. Docs and live previews stay open to everyone, so you can read every block's details first.

Upgrade Now

Installation

Swap YOUR_EMAIL and YOUR_KEY for the email and license key on your account. Find your license key on your account page.

Radix flavor

bash
npx shadcn add "https://beste.dev/r/navbar102?email=YOUR_EMAIL&license_key=YOUR_KEY"

Base UI flavor

bash
npx shadcn add "https://beste.dev/r-base/navbar102?email=YOUR_EMAIL&license_key=YOUR_KEY"

This installs the block to components/beste/block/navbar102.tsx plus the shadcn button primitive it uses, and adds framer-motion for the sliding indicator.

Quick start

The installed file exports navbar102Demo alongside the block: the exact props behind the preview above. Spread it to get a working navbar in one line.

tsx
import { Navbar102, navbar102Demo } from "@/components/beste/block/navbar102";

export default function Page() {
  return <Navbar102 {...navbar102Demo} />;
}

Then replace the demo with your own props. Written out, a trimmed setup looks like this:

tsx
import { Navbar102 } from "@/components/beste/block/navbar102";

export default function Page() {
  return (
    <Navbar102
      brand="Orbit"
      links={[
        { label: "Product", href: "/product" },
        { label: "Pricing", href: "/pricing" },
      ]}
      action={{ label: "Try Orbit free", href: "/signup" }}
      subnav={{
        title: "Orbit Analytics",
        items: [
          { label: "Overview", href: "#overview" },
          { label: "Dashboards", href: "#dashboards" },
          { label: "Pricing", href: "#pricing" },
        ],
      }}
      defaultActive={0}
      labels={{ open: "Open menu", close: "Close menu", sections: "Page sections" }}
    />
  );
}

Props

PropTypeDefaultDescription
brandstring–Wordmark on the left of the main bar
linksNavItem[][]Main links; a scrollable pill row on a phone
actionActionButton–Button on the right of the main bar
subnavSubNav–Title and section pills of the second row
defaultActivenumber–Index of the pill that starts active; the first pill when unset
labels{ open?: string; close?: string; sections?: string }{}Accessible names for the mobile toggle and the pill list
classNamestring–Extra classes for the outer <header>
ts
type SubNav = {
  title?: string;
  items: NavItem[];
};

type NavItem = {
  label: string;
  href: string;
};

type ActionButton = {
  label: string;
  href: string;
  variant?: "default" | "outline" | "ghost" | "secondary";
};

Behavior notes

  • Both rows live inside one sticky <header>, so the section pills stay pinned under the main bar while the page scrolls.
  • The active pill is set by click and marked with aria-current="location"; a single motion.span with a layoutId from useId moves between pills, and the move is instant when the visitor prefers reduced motion.
  • Point the pill href values at section anchors on the page (#pricing); the link keeps its native jump while the indicator slides.
  • The mobile pill row is always rendered and toggled with CSS classes, so its links are in the server-rendered HTML; while closed it carries aria-hidden and inert. The toggle has aria-expanded, Escape closes the row and a link click closes it.
  • Both pill rows scroll horizontally with hidden scrollbars; the mobile row snaps each pill to the start edge.

More Navigation blocks

View all Navigation
PRO

navbar112

Hide on Scroll Bar

PRO

navbar71

Pill Menu Navbar

PRO

navbar119

Pill Navbar on Deep Green

Get Pro