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 { FloatingDock } from "@/app/lib/components/floating-dock";<FloatingDock items={[
{ icon: <HomeIcon />, label: "Home", onClick: () => {} },
{ icon: <SearchIcon />, label: "Search" },
]} />API
Props
| Prop | Type | Default |
|---|---|---|
items* | DockItem[] | — |
gapGap between icons in pixels. Default: 8 | number | 8 |
iconSizeBase icon size in pixels. Default: 48 | number | 48 |
maxScaleMaximum scale factor on proximity. Default: 1.2 | number | 1.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.