Getting Started
Components
Special Effects
Animations
Text Animations
Backgrounds
A macOS-style dock component with smooth magnification animation on hover, inspired by the macOS dock.
motion-sv
Dock
Installation
pnpm dlx shadcn-svelte@latest add https://sv-animations.vercel.app/r/dock.json
Install dependencies
Install the required packages for this component:
pnpm add motion-sv
Copy the Source Code
Copy and paste the following code into your project:
dock.svelte
dock-icon.svelte
index.ts
Folder Structure
Folder Structure
Examples
Direction
Direction: Top
Direction: Middle (Default)
Direction: Bottom
Custom Magnification
Colored Icons
Disabled Magnification
Props
Dock
The main dock container that provides context and handles mouse tracking for magnification effects.
| Name | Type | Default | Description |
|---|---|---|---|
class | string | "" | Additional CSS classes to apply. |
iconSize | number | 40 | The base size of icons in pixels. |
iconMagnification | number | 60 | The magnified size of icons when hovered. |
disableMagnification | boolean | false | Disables the magnification effect on hover. |
iconDistance | number | 140 | The distance in pixels at which magnification starts to take effect. |
direction | "top" | "middle" | "bottom" | "middle" | The alignment direction of icons within the dock. |
children | Snippet | - | The dock icon children to render inside the dock. |
DockIcon
Individual icon wrapper that responds to the dock's magnification context.
| Name | Type | Default | Description |
|---|---|---|---|
class | string | "" | Additional CSS classes to apply. |
children | Snippet | - | The icon content to render inside the dock icon. |