Motion Blocks

Interaction

Floating Menu

A floating navigation menu with staggered link reveals and animated toggle lines.

  • lit Preview of https://lit.devLitSimple. Fast. Web Components.
  • gsap Preview of https://gsap.comGSAPAnimate anything. Silky-smooth performance.

Preview

Open the floating menu to reveal grouped navigation links with staggered GSAP transitions.

Installation

pnpm dlx motion-blocks add floating-menu

Usage

---import "@/components/motion-blocks/floating-menu-element.ts"; const menuGroups = [  {    title: "Explore",    links: [      { label: "Home", href: "/" },      { label: "About", href: "/about" },      { label: "Contact", href: "/contact" }    ]  },  {    title: "Resources",    variant: "muted",    links: [      { label: "Blog", href: "/blog" },      { label: "Docs", href: "/docs" }    ]  }]; const logoHtml = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/></svg>`;--- <motion-floating-menu  menu-groups={JSON.stringify(menuGroups)}  logo-html={logoHtml}  primary-button={JSON.stringify({ label: "Get Started", href: "/start" })}  secondary-button={JSON.stringify({ label: "Login", href: "/login" })}  class="w-full"/>

API Reference

Attribute Type Default
menu-groups JSON string array of menu groups. Each group has title, optional variant ('default' or 'muted'), and links array with label and href. string (JSON) "[]"
logo-html HTML string for the logo displayed in the header (SVG or image tag). string ""
primary-button JSON string with label and href for the primary CTA button. string (JSON) ""
secondary-button JSON string with label and href for the secondary button (hidden on mobile). string (JSON) ""