Morphiq

Components / Magnifying Dock

Magnifying Dock

A dock whose items swell as the pointer nears, on springs. Distance drives the scale, so the whole row breathes rather than one icon popping.

Usage

import Dock from '@/components/dock/Dock'

<Dock
  baseSize={40}
  magnifiedSize={90}
/>

Installation

npx shadcn@latest add https://morphiq.prathampatel.design/r/dock.json

Model

m·ẍ = −k·(x − size(d)) − c·ẋ

size(d) the target size at pointer distance d · m 0.1 · k 200 · c 15

Props

PropertyTypeDefaultDescription
itemsDockItem[]DOCK_ITEMSDefaults to the five-icon row the demos show.
activeIdstring | null—Controlled selection. Pass null for none.
defaultActiveIdstring | nullnullStarting selection when uncontrolled.
onSelect(id: string | null, item: DockItem | null, index: number) => void—Fires on every activation, including deselection, where id is null.
baseSizenumber36Item size at rest, in px.
magnifiedSizenumber54Item size directly under the pointer, in px.
surfacestring'#08101e'—
borderstring'#142544'—
itemBorderstring'#0c1f43'—
accentstring'#639aff'—
iconstring'#ffffff'—