Floating Nav

A floating navbar that scales items on hover, inspired by macos floating dock.

Preview

See the preview of the floating nav at bottom center of the screen.

Installation

1. Run the following command in your terminal:
npx shadcn@latest add https://refinery.abhii.me/r/floating-nav.json

API Reference

Component props
NameTypeDescription
itemsNavEntry[]List of navigation items to display in the floating nav. Each item can be a NavItem (with label, icon, and href) or a NavSeparator (a simple divider).
iconSizenumberBase size in pixels for the icon cells. The icons will scale up on hover based on this size. Default is 44px.
showTooltipbooleanWhether to show tooltips with the item labels when hovering over the icons. Default is true.
classNamestringAdditional CSS classes to apply to the floating nav container for custom styling.
Design Notes

Horizontal mouse position is tracked and each item's distance from the pointer is used to decide how much it should scale. Motion values and springs keep the dock movement smooth instead of snappy. Each item can be a link or a button, and you can keep the hover tooltips on for labels or turn them off when the icons are already clear.