An elegant, morphing pill navigation bar with fluid spring physics, outside-click close detection, and staggered entrance links.
$ npx shadcn@latest add https://akshitr.com/r/floating-nav.json
import FloatingNav from "@/components/floating-nav";
export default function Example() {
return (
<FloatingNav
links={[
{ label: "Home", href: "#" },
{ label: "Work", href: "#" },
{ label: "About", href: "#" },
{ label: "Contact", href: "#" },
]}
socials={[
{ label: "GitHub", href: "https://github.com" },
{ label: "Twitter", href: "https://twitter.com" },
]}
position="bottom"
/>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
links | FloatingNavLink[] | DEFAULT_LINKS | Navigation links rendered inside the expanded menu body. |
socials | FloatingNavSocial[] | DEFAULT_SOCIALS | Secondary social media links with external arrow icons. |
position | "top" | "bottom" | "bottom" | Pin navigation to viewport top or bottom edge. |
initialOpen | boolean | false | Initial expanded state on mount. |