# Magnifying dock

> A row of app icons where the one under your cursor grows and lifts, and its neighbors swell a little too.

- Category: [Navigation](https://library.aimran.es/components/navigation)
- Built with: React + Motion
- Live editor: https://library.aimran.es/blocks/macos-dock
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Anyone who has used a Mac knows this dock, and that familiarity is the point. It works as a playful navigation for a designer’s portfolio, the quick links of a personal site or a toolbar inside a web app. People searching for a macOS dock effect in React usually want exactly this: icons that grow under the mouse.

Keep the zoom modest, around 1.4, or icons start overlapping. Add tooltips or labels if the icons are not obvious. On phones there is no hover, so make sure each icon still works as a plain button there.

## Code

### React (Motion)

```tsx
import { useState } from "react";
import { motion } from "framer-motion";
import { Calendar, Compass, Layers, MessageCircle, User } from "lucide-react";

const spring = { type: "spring" as const, stiffness: 300, damping: 30 };

const ITEMS = [
  { icon: Compass, label: "Explore" },
  { icon: Calendar, label: "Calendar" },
  { icon: MessageCircle, label: "Messages" },
  { icon: Layers, label: "Layers" },
  { icon: User, label: "Profile" },
];

interface DockProps {
  zoom?: number;
}

export default function Dock({ zoom = 1.45 }: DockProps) {
  const [hover, setHover] = useState(-9);

  return (
    <div className="flex h-24 items-end gap-2 rounded-[22px] bg-white/70 dark:bg-black/70 p-3 text-[#1d1d1f] dark:text-[#f5f5f7] shadow-[0_1px_2px_rgba(0,0,0,0.03),0_8px_28px_rgba(0,0,0,0.05)] backdrop-blur-[20px]">
      {ITEMS.map(({ icon: Icon, label }, i) => (
        <motion.button
          key={label}
          type="button"
          aria-label={label}
          onHoverStart={() => setHover(i)}
          onHoverEnd={() => setHover(-9)}
          animate={{
            scale: hover === i ? zoom : Math.abs(hover - i) === 1 ? 1.12 : 1,
            y: hover === i ? -10 : 0,
          }}
          transition={spring}
          className="grid h-11 w-11 place-items-center rounded-xl bg-white dark:bg-[#1c1c1e] shadow-[0_1px_2px_rgba(0,0,0,0.03),0_8px_28px_rgba(0,0,0,0.05)]"
        >
          <Icon className="h-5 w-5" />
        </motion.button>
      ))}
    </div>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Magnifying dock” block (Navigation) from AIMRAN Library to my project.

## What it is
A row of app icons where the one under your cursor grows and lifts, and its neighbors swell a little too.

## Chosen settings
- Magnification: 1.45 (from 1.1 to 1.7)

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with React + TypeScript, with framer-motion for the animation and lucide-react for the icons. If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
import { useState } from "react";
import { motion } from "framer-motion";
import { Calendar, Compass, Layers, MessageCircle, User } from "lucide-react";

const spring = { type: "spring" as const, stiffness: 300, damping: 30 };

const ITEMS = [
  { icon: Compass, label: "Explore" },
  { icon: Calendar, label: "Calendar" },
  { icon: MessageCircle, label: "Messages" },
  { icon: Layers, label: "Layers" },
  { icon: User, label: "Profile" },
];

interface DockProps {
  zoom?: number;
}

export default function Dock({ zoom = 1.45 }: DockProps) {
  const [hover, setHover] = useState(-9);

  return (
    <div className="flex h-24 items-end gap-2 rounded-[22px] bg-white/70 dark:bg-black/70 p-3 text-[#1d1d1f] dark:text-[#f5f5f7] shadow-[0_1px_2px_rgba(0,0,0,0.03),0_8px_28px_rgba(0,0,0,0.05)] backdrop-blur-[20px]">
      {ITEMS.map(({ icon: Icon, label }, i) => (
        <motion.button
          key={label}
          type="button"
          aria-label={label}
          onHoverStart={() => setHover(i)}
          onHoverEnd={() => setHover(-9)}
          animate={{
            scale: hover === i ? zoom : Math.abs(hover - i) === 1 ? 1.12 : 1,
            y: hover === i ? -10 : 0,
          }}
          transition={spring}
          className="grid h-11 w-11 place-items-center rounded-xl bg-white dark:bg-[#1c1c1e] shadow-[0_1px_2px_rgba(0,0,0,0.03),0_8px_28px_rgba(0,0,0,0.05)]"
        >
          <Icon className="h-5 w-5" />
        </motion.button>
      ))}
    </div>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
