Dock
Magnifying dock on springs, with tooltips, running tubes, badges, separators and a one-stop keyboard toolbar.
Installs @radix-ui/react-slot and motion.
Tue 14:02
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/dock.jsonUsage
import { Dock, DockItem, DockSeparator } from "@/components/ui/dock"
<Dock aria-label="Dock">
<DockItem label="Mail" badge={12} running>
<Mail />
</DockItem>
<DockSeparator />
<DockItem label="Trash">
<Trash2 />
</DockItem>
</Dock>Examples
Vertical, with links
asChild renders each item as a link. The running tube marks the current page, and aria-current says so to screen readers.
Without magnification
magnification={1} keeps every icon still, for a canvas toolbar.
API reference
Dock
| Prop | Type | Default |
|---|---|---|
orientation | "horizontal"Horizontal icons grow upward; vertical ones grow to the right. | "horizontal" |
size | "sm"Icons of 36, 44 or 54px at rest. | "md" |
magnification | numberThe size of the icon under the pointer, as a multiple of its rest size. 1 turns it off. | 1.6 |
distance | numberPixels from the pointer within which icons grow. | 140 |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
DockItem
A button, or with asChild any element such as a link. Other props go on that element.
| Prop | Type | Default |
|---|---|---|
label | stringAccessible name and tooltip. | None |
running | booleanLights the small tube under the icon. | false |
runningLabel | stringWhat screen readers hear for running, as the item's description. | "open" |
badge | ReactNodeA count or short word in a lit pill on the corner. | None |
badgeColor | NeonColorColor of the badge. | "red" |
asChild | booleanRenders the child element as the item. Base UI's render prop works too. | false |
disabled | booleanDims the item and skips it in keyboard navigation. | false |
DockSeparator
A hairline between groups of items.
| Prop | Type | Default |
|---|
Accessibility
- The dock is a toolbar with one tab stop. Arrow keys along its axis move focus, Home and End jump to the ends, and keyboard moves never magnify.
- Touch input never magnifies, and neither does anything under reduced motion.
- Give the dock an aria-label. Badges and the running state are read as each item's description.