Kinetic UI
Back to Introduction
Physics & Micro-Interactions

Magnetic Planetary Menu

Orbiting circular icons that dynamically pull towards the cursor when hovered and snap into elliptical paths.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add magnetic-orbit-menu
Magnetic Planetary Menu

Installation

npx kinetic-ui-cli@latest add magnetic-orbit-menu

Mechanics

This component merges continuous trigonometric animation with reactive physics:

  1. Orbit Paths: A global requestAnimationFrame loop increments a time variable. Each planetary node calculates its Cartesian (x, y) position relative to the center using Math.cos() and Math.sin().
  2. Hover Pause: When any node (or the center avatar) is hovered, the global time loop halts, pausing the orbit so the user can comfortably click the target.
  3. Magnetic Core: The center avatar maps its translation to cursorX and cursorY via useSpring, creating a subtle parallax pull effect as you move your mouse across the container.

Usage Guide

1. Import the Component

Import the component into your React or Next.js page:

import { MagneticOrbitMenu } from "@/components/creative/magnetic-orbit-menu";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { MagneticOrbitMenu } from "@/components/creative/magnetic-orbit-menu";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <MagneticOrbitMenu
      />
    </div>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.