Floating Dock
Icons grow with the pointer's distance through a spring, a name shows above the one you point at or focus, and the current one has a dot. Arrow keys move between icons. On a phone it folds into one button.
The decision inside it
Folds on a phone
A row of icons does not fit a narrow screen or a finger, so below 640px it becomes one button that opens a column with names.
When to use it
Use Floating Dock for a small set of top-level destinations or tools shown as icons in a floating bar, on a portfolio, a canvas app or a mobile web app. For a site with many pages, use a navbar or sidebar.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Layro's Floating Dock for this.
Install it: npx shadcn@latest add @layro/floating-dock
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/floating-dock.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.
Usage
import { FolderOpen, Home, Settings } from "lucide-react";
import { FloatingDock } from "@/components/ui/floating-dock";
export function AppDock() {
return (
<FloatingDock
className="fixed inset-x-0 bottom-6 mx-auto"
items={[
{ label: "Home", icon: <Home />, href: "/", active: true },
{ label: "Documents", icon: <FolderOpen />, href: "/documents" },
{ label: "Settings", icon: <Settings />, href: "/settings" },
]}
/>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Prop | Type | Notes |
|---|---|---|
itemsrequired | DockItem[] | — |
position | "bottom" | "top" | Where it sits, so names and the folded menu open the right way. Default "bottom". |
magnify | boolean | Grow icons near the pointer. Default true. |
mobileCollapse | boolean | Fold into one button below 640px of screen width. Default true. |
size | number | Icon size at rest, in pixels. Default 40. |
label | string | The dock's name for screen readers. Default "Dock". |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-themeStates
All of them are drawn by the component. None is left for you to design.
- Rest
- Magnified
- Name showing
- Active item
- Folded
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances
Lifetime access
Every component, and everything we ship next.
- All 232 components, source included
- Every template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.