Skip to content

Floating dock

Icons lift a few pixels, scale a little and glow with position-mapped pastel colour when you point at them, on spring physics. Slots never resize, so nothing slides out from under the cursor and every icon stays where you aimed. Keyboard focus moves the same highlight; with reduced motion only the glow responds.

  • Spring Physics
  • Proximity Detection
  • pastelColour

Usage

Drop it in

import
import { FloatingDock } from "@/app/lib/components/floating-dock";
example 1
<FloatingDock items={[
  { icon: <HomeIcon />, label: "Home", onClick: () => {} },
  { icon: <SearchIcon />, label: "Search" },
]} />

API

Props

PropTypeDefault
items*DockItem[]—
gap

Gap between icons in pixels. Default: 8

number8
iconSize

Base icon size in pixels. Default: 48

number48
maxScale

Maximum scale factor on proximity. Default: 1.2

number1.2

Read from the component's source at build time. * required.

Accessibility

Works with

Cursor
Reacts to where the pointer is, not just whether it's over the element.
Touch
Follows your finger while it's down, then settles a moment after you lift.
Keyboard
Focus lights it up the way the cursor does. Every action has a key.
Reduced motion
Nothing moves or springs. Colour still answers, without drifting.