Magnifying dock
A row of app icons where the one under your cursor grows and lifts, and its neighbors swell a little too.
Settings
Code
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
Paste it into ChatGPT, Claude or Cursor and it will adapt the block to your project with these settings, even if you don’t use React.
More in Navigation
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.