Floating Dock
A compact contextual dock whose active destination expands with its label and whose pointer response stays an optional desktop enhancement.
- navigation
- proximity
- magnetic
- depth
- dock
- toolbar
- magnify
- nav
Quick usage
usage
import { FloatingDock } from "@pinky-ui/components";
<FloatingDock
items={items}
magnification={1.35}
distance={120}
/>Presets
Subtle
Barely swells. Good beside content.
magnification={1.18} distance={90}
Default
Clear response without theatre.
magnification={1.35} distance={120}
Playful
A statement dock, alone on the page.
magnification={1.6} distance={160}
Install
Add @pinky-ui/components as a dependency, or use the CLI to copy this component's source directly into your project — no dependency to manage, fully editable.
shell
npm install @pinky-ui/componentsshell
pnpm add @pinky-ui/componentsshell
yarn add @pinky-ui/componentsshell — copies source into your project
npx pinky-ui add floating-dockPrefer to run the whole repository locally instead?
repository
git clone https://github.com/florash/Pinky-UI.git
cd Pinky-UI
npm install
npm run devProps
| Prop | Type | Default | Description |
|---|---|---|---|
| items | DockItem[] | — | Each needs an id, a label and an icon; href or onSelect makes it actionable. |
| magnification | number | 1.35 | Scale of the item under the pointer. |
| distance | number | 120 | Falloff distance in px. |
| labels | boolean | true | Show the label above the nearest item. |
| aria-label | string | "Dock" | Names the navigation landmark. |
Accessibility
- Renders a nav landmark with a list of real links or buttons.
- Every item carries a permanent visually-hidden label — the hover label is decoration, not the accessible name.
- Fully operable by Tab and Enter with no pointer proximity involved.
- Active items expose aria-current (links) or aria-pressed (buttons), and the active label remains visible for touch users.
- Magnification is skipped for touch, while the active destination remains named in the surface.
Reduced motion
With prefers-reduced-motion: reduce, items never scale or lift and the hover label stays hidden. The dock is a plain, fully functional row of icons.
When to use
- A small set of primary destinations or tools
- Persistent app-level navigation on wide screens
- Demo and portfolio interfaces
When not to use
- More than about eight items
- Primary navigation on mobile, where proximity has no meaning
- Anywhere the icons are not genuinely recognisable without labels