A macOS-style floating dock with magnetic hover animations and keyboard navigation.
Made by raouf.codesOverview
The FloatingDock component provides a macOS-style dock with magnetic hover effects, spring physics animations, and full keyboard accessibility.
Subcomponents & hooks:
FloatingDock— root component (context provider, mouse/keyboard handling)FloatingDock.Item— interactive dock item with animated scalingFloatingDock.Separator— visual divider between item groupsuseDock()— advanced hook for custom integrations
Installation
Usage
Basic
With Separator
Using useDock() for custom items
API Reference
FloatingDock (root)
| Prop | Type | Default |
|---|---|---|
orientation? | enum | "vertical" |
size? | enum | "md" |
intent? | enum | "primary" |
styling? | enum | "solid" |
shape? | enum | "pill" |
elevation? | enum | "raised" |
className? | string | - |
...props? | ComponentProps<"div"> | - |
FloatingDock.Item
Azemmur API Reference - Button Primitive
| Prop | Type | Default |
|---|---|---|
item | DockItemData | - |
tabIndex? | number | 0 |
className? | string | - |
...props? | ComponentProps<"a"> | - |
FloatingDock.Separator
| Prop | Type | Default |
|---|---|---|
className? | string | - |
...props? | ComponentProps<"div"> | - |
DockItemData
| Prop | Type | Default |
|---|---|---|
title | string | - |
icon | React.ReactNode | - |
href | string | - |
obfuscated? | boolean | false |
useDock()
Hook to access dock context values for building custom dock items.
| Prop | Type | Default |
|---|---|---|
mousePosition? | MotionValue<number> | - |
isVertical? | boolean | - |
orientation? | "vertical" | "horizontal" | - |
size? | "sm" | "md" | "lg" | - |
intent? | "primary" | "accent" | "secondary" | "success" | "info" | "warning" | "error" | - |
styling? | "solid" | "outline" | "ghost" | "link" | - |
shape? | "rounded" | "pill" | "sharp" | - |
elevation? | "raised" | "floating" | - |
Keyboard Navigation
Keyboard navigation adapts to the dock orientation:
Vertical orientation:
| Key | Action |
|---|---|
Arrow Down | Move focus to the next item |
Arrow Up | Move focus to the previous item |
Horizontal orientation:
| Key | Action |
|---|---|
Arrow Right | Move focus to the next item |
Arrow Left | Move focus to the previous item |
Common keys:
| Key | Action |
|---|---|
Enter / Space | Activate the focused link |
Tab | Move focus into/out of the dock |
Features
- Magnetic hover effect — Icons smoothly scale based on mouse proximity
- Spring animations — Natural feeling physics-based transitions
- Keyboard navigation — Full arrow key support with focus management
- Accessibility — Proper ARIA labels and keyboard focus indicators
- Link obfuscation — Optional base64-encoded hrefs for spam protection
- Variant system — Full support for intent, styling, shape, and elevation
Credits
- Inspired by macOS dock interactions
- Built with Motion for animations
Built by raouf.codes. The source code is available on GitHub.
Last updated: 2/27/2026