Dock
MotionA macOS style dock for React: icons magnify under the pointer with spring physics and show a label. Real buttons or links, keyboard reachable and labelled.
Installation
npx shadcn@latest add @minidev/dock
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/dock.json
Usage
import { Dock } from "@/components/ui/dock"
export function Example() {
return (
<Dock />
)
}
API reference
When to use
Every item is a real button (with onClick) or link (with href), reachable and labelled for keyboard and screen reader users; focus shows the label too. Magnification is pointer only and off for reduced motion. Use it for an app launcher or a playful bottom nav on marketing pages; for product navigation use a sidebar or Tabs.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Moves to each dock item and shows its label above it. |
| Enter | Follows the link, or runs onClick on a button item. |
| Space | Activates a button item. |
Accessibility
- The dock is a
<nav>named bylabel(default "Dock"). Each item hasaria-labelfrom itslabel, and the active one hasaria-current="page". - The floating label and the running dot are
aria-hidden, so names are not read twice. The label also shows on keyboard focus.
Frequently asked questions
Can Dock items be Next.js links?
An item with href renders a plain <a>, not a Next.js Link, so it does a full page load. For client-side navigation, use onClick with router.push, or edit the motion.a in the file.
Does the magnification work on phones?
It is made for a mouse. The swell follows pointermove across the dock, so on touch the icons mostly stay at size (44px). Under reduced motion magnify is ignored and icons never grow.
Dependencies
npm
Built from
Examples
Custom items with links
Each item takes a label and a lucide icon; with href it renders a link, and active adds the dot underneath.
Bigger swell
size is the resting icon, magnify the size under the pointer and distance how far the swell reaches.
Active item
Keep the current page in state and set active and onClick per item to use the dock as app navigation.