Dock
ProA macOS-style dock whose icons scale with pointer proximity.
Installation
pnpm dlx shadcn@latest add @viewport/dock
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
<Dock>
| Prop | Type | Default |
|---|---|---|
| size | numberResting icon size in pixels. | 44 |
| magnify | numberIcon size at the pointer in pixels. | 68 |
| distance | numberPixels from the pointer over which icons scale. | 130 |
| label | stringAccessible name for the toolbar. | "Dock" |
| className | string | — |
| children* | React.ReactNode | — |
<DockItem>
| Prop | Type | Default |
|---|---|---|
| label* | stringTooltip text and accessible name. | "Dock" |
| active | booleanShows the running-app indicator. | — |
| children* | React.ReactNode | — |
Accessibility
- Exposed as a toolbar with an accessible name.
- Every item is a labelled button; tooltips also show on keyboard focus.
- Icons stay at rest size for touch input and under reduced motion.