GooeyMenu

A delightfully elastic, blobby menu animation with springy physics and gooey SVG wizardry. Toggle yon button, summon thine icons, and behold them glide left, right, top, or bottom—’tis pure dev alchemy!




Installation



Understanding the Component

Menu Item Animation

Each menu item slides outward from the center along a chosen axis when the menu opens.

  • Axis (x or y) and direction (+1 or 1) calculated from the direction prop.
  • Items offset by 100% * index plus a pixel-based gap.

Toggle Icon Blur Effect

The open/close icon smoothly blurs in and out to mask the swap between hamburger and close icons.

  • Uses AnimatePresence to handle mounting/unmounting.
  • blurAni variants apply CSS filter: blur() and opacity transitions.

SVG Gooey Filter

Applies a “gooey” merging effect to overlapping items via an SVG filter.

  • Combines feGaussianBlur and feColorMatrix.
  • Blended back with the source graphic for the gooey look.

Props

PropTypeDefaultDescription
itemsMenuItem[]noneArray of menu items with icon, name, and optional data.
classNamestring"none"Additional CSS classes for the main toggle button.
filterIdstring"gooey-menu-filter"ID used for the SVG filter to avoid collisions.
transitionTransition{ type: "spring", duration: 0.5, bounce: 0.3 }Motion transition settings for item animations.
onChange(item: MenuItem) => voidnoneCallback invoked when a menu item is clicked.
direction"left" | "right" | "top" | "bottom""top"Direction in which items expand from the toggle button.

Interface - MenuItem (exported)

PropTypeDefaultDescription
iconReact.ReactElementnoneThe visual icon for the menu item.
namestringnoneAccessible label for the menu item.
metadataanynoneOptional data for use in the onChange.
valueanynoneOptional value passed to the onChange.