Animated Navbar
A highlight slides under whichever link the pointer is on, groups open a small menu, and below a width of its own it folds into a menu button. It can stay put, hide while you scroll down, or shrink into a floating bar.
The decision inside it
It folds by its own width, not the screen's
So it works in a preview frame, a sidebar layout or a narrow container, and the menu button appears exactly when the links stop fitting.
When to use it
Use Animated Navbar as the header of a marketing site: links with a sliding highlight, groups that open a menu, and a mobile menu when the links stop fitting. For an app's own navigation use a sidebar.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Layro's Animated Navbar for this.
Install it: npx shadcn@latest add @layro/animated-navbar
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/animated-navbar.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.
Usage
import { AnimatedNavbar } from "@/components/ui/animated-navbar";
export function SiteHeader() {
return (
<AnimatedNavbar
logo={<span className="font-semibold">Madgixs</span>}
items={[
{ label: "Product", children: [{ label: "Templates", href: "/templates" }, { label: "Signing", href: "/signing" }] },
{ label: "Pricing", href: "/pricing" },
{ label: "Customers", href: "/customers" },
]}
actions={<a href="/signup">Start free</a>}
behavior="shrink-on-scroll"
variant="floating"
currentHref="/pricing"
/>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Prop | Type | Notes |
|---|---|---|
logorequired | React.ReactNode | Your mark, usually a link home. |
itemsrequired | NavbarItem[] | — |
actions | React.ReactNode | On the right: sign in, a call to action. |
behavior | "static" | "hide-on-scroll" | "shrink-on-scroll" | What scrolling does. Default "shrink-on-scroll". |
variant | "full" | "floating" | "full" spans the width; "floating" is a rounded bar with a gap above. Default "full". |
mobileBreakpoint | "sm" | "md" | "lg" | Below this width of the bar, items fold into a menu. Default "md". |
scrollContainer | React.RefObject<HTMLElement | null> | The element that scrolls, when it is not the window. |
currentHref | string | The current page's href, marked aria-current. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-themeStates
All of them are drawn by the component. None is left for you to design.
- Default
- Hover highlight
- Group open
- Shrunk on scroll
- Mobile menu open
- Reduced motion
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances
Lifetime access
Every component, and everything we ship next.
- All 232 components, source included
- Every template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.