Magnify Dock, animated React component
A macOS-style app dock: icons swell as the pointer passes over them, show a label above, bounce when launched and keep a running dot underneath.
- Pro
- Navbars
- Hover
- Spring
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| apps | DockApp[] | Apple Intelligence, Maps, Music, TV, Claude, Chrome | Each app has id, label, icon (an image URL of the finished app icon), and bg (any CSS background) and glyph (an icon) for the tile that shows when there is no icon or it fails to load. |
| autoplay | boolean | false | Sweeps an invisible pointer across the dock until someone hovers it. |
| baseSize | number | 46 | Resting size of every icon in px, 32 to 64. |
| maxSize | number | 76 | Size of the icon right under the pointer in px, up to 104. It never goes below baseSize. |
| reach | number | 150 | How far from the pointer, in px, icons still swell, 40 to 320. A small reach magnifies one icon, a large one lifts a whole group. |
| gap | number | 10 | Space between icons in px, 0 to 28. |
| stiffness | number | 320 | How firmly icons spring to their new size, 100 to 800. Higher is snappier. |
| showLabels | boolean | true | Shows the app's name above it while it is hovered or focused. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Magnify Dock is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
Magnify Dock questions
How do I install Magnify Dock?
Run `npx shadcn@latest add @nexus-labs/magnify-dock`. It installs framer-motion. Magnify Dock is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
How do I set my own icons?
Pass `apps` as an array of `DockApp`: `id`, `label`, `bg` (any CSS background) and `glyph` (any React node). Without it you get seven sample apps, from Home to Settings.
How do I change how much the icons grow?
It is not a prop. Edit the constants at the top of the file: `BASE` (46) is the resting size in px, `MAX` (76) the largest size, and `RANGE` (150) how far from the pointer the swelling reaches.
What happens when I click an icon, and can I run my own code?
The icon bounces and a dot appears under it, with Home marked as running from the start. There is no click callback prop, so to run your own action edit the `onLaunch` handler in the source.
Does it work with the keyboard?
Icons are buttons inside a `role="toolbar"` named "Dock", with a visible focus outline, and focusing one shows its label. The swelling follows the pointer only, so keyboard users see no magnification.