Skip to content

Dock

Motion

A 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.

src/registry/premium/dock.tsx/r/dock.json

Installation

bash
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

tsx
import { Dock } from "@/components/ui/dock"

export function Example() {
  return (
    <Dock />
  )
}

API reference

Dock props
PropTypeDefault
itemsDockItem[]DEFAULT
labelAccessible name of the dock's nav landmark.string"Dock"
sizeResting icon size in pixels.number44
magnifySize under the pointer.number68
distanceHow far the swell reaches, in pixels.number130
classNamestring-

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

Keyboard interactions
KeyAction
TabMoves to each dock item and shows its label above it.
EnterFollows the link, or runs onClick on a button item.
SpaceActivates a button item.

Accessibility

  • The dock is a <nav> named by label (default "Dock"). Each item has aria-label from its label, and the active one has aria-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

lucide-reactmotion

Built from

No other MiniDev files

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.

All navigation components