Easeout LabMagnetic Dock
Magnetic Dock
A macOS-style dock: icons swell under the cursor and push their neighbours aside, each on a critically damped spring.
Install
npx shadcn add@easeout/magnetic-dockDependencies
motiontailwindcss
Tags
NavigationFree componentMIT
Usage
After installing, it lives at components/magnetic-dock.tsx
"use client"
import { MagneticDock } from "@/components/magnetic-dock"
export default function Example() {
return (
<MagneticDock
aria-label="Apps"
items={[
{ label: "Home", icon: <span aria-hidden="true">⌂</span>, onClick: () => {} },
{ label: "Search", icon: <span aria-hidden="true">⌕</span>, onClick: () => {} },
{ label: "Settings", icon: <span aria-hidden="true">⚙</span>, onClick: () => {} },
]}
/>
)
}
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
items | { label: string; icon: ReactNode; onClick?: () => void; bg?: string; fg?: string }[] | – | The icons, with a tile colour and an icon colour each. |
max | number | 1.55 | The biggest scale an icon reaches under the cursor. |
autoplay | boolean | false | A virtual cursor sweeps across until a real mouse arrives. Works on touch screens too. |
aria-label | string | "Dock" | Accessible name of the dock. |
className | string | – | Classes for the dock. |