Floating Dock

A floating bar of icons that swell near the pointer, like the macOS dock.

PROGet Floating Dock and 168 other Pro components with pro lifetime — Get Pro

Category
Navigation & layout
Access
Pro
Source
222 lines · one file
States
5 drawn

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 Liro's Floating Dock for this.
Install it: npx shadcn@latest add @liro/floating-dock
(the @liro registry is set up in components.json, with LIRO_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 @liro registry with your CLI token: see the Namespaced tab.

Usage

components/app-dock.tsx
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.

TypeNotes
itemsDockItem[] Yes–
position"bottom" | "top" NoWhere it sits, so names and the folded menu open the right way. Default "bottom".
magnifyboolean NoGrow icons near the pointer. Default true.
mobileCollapseboolean NoFold into one button below 640px of screen width. Default true.
sizenumber NoIcon size at rest, in pixels. Default 40.
labelstring NoThe dock's name for screen readers. Default "Dock".

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-theme

States

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