Skip to content

macOS Dock for React

A macOS dock for React with magnification: icons near the pointer swell and push their neighbors apart, with labels riding on top.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/dock.json
  • Dock
  • DockItem
  • DockSeparator
  • defaultDockLabels
  • +2 more

App dock

Move the pointer along it. Click an app to see it bounce. Keyboard: Tab into it, then arrow keys, Home and End; the focused app swells too, and Escape hides its label. Open apps (the dot) say so to screen readers: “Finder, open”. In a narrow window it turns into a plain bar that scrolls inside itself, with the label drawn above the bar.

Files to copy

5 folders · 4 files · 4 packages
From theme/src/
  • components/dock/
  • hooks/{use-media-query.ts, use-preferences.ts}
  • motion/tokens.ts
  • lib/cn.ts
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/dock.jsonRegistry item: dock. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/spinner/
  • components/toast/
  • hooks/use-direction.ts
  • lib/state-light.tsx
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/toast.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Items with href are links (aria-current marks the active one). side="top" grows the icons downward with labels underneath. Smaller icons, a gentler swell.

Notch

With notch, the active item lifts out of a round notch cut into the glass bar and glides to the next active item. Click an icon to move it. Needs an active item.

Dock props

PropTypeDefaultDescription
children (required)ReactNodeNoneHolds the dock items and separators.
labelstring"Dock"Sets the accessible name of the toolbar.
labelsPartial<DockLabels>defaultDockLabelsTranslatable strings: labels.active ("open") is added to the accessible name of active button items, e.g. "Finder, open". Links use aria-current instead. Every other string, for translation: labels={{ active: "…" }}; omitted keys keep the English of defaultDockLabels. Its only key is listed in the key table under the props table.
size"sm" | "md" | "lg""md"Icon size at rest: sm 40px, md 48px or lg 56px (never below 44px on touch screens).
magnificationnumber1.6How much the icon under the pointer grows: 1 (off) to 2. Reduced to fit when there is little room beside the dock.
distancenumber2.75 × sizeHow far the swell reaches either side of the pointer, in px.
sideDockSide"bottom"Which edge the dock sits on. Icons grow away from it, labels show on the far side.
notchbooleanfalseThe active item lifts out of a round notch cut into the glass bar (the notch is part of the bar's own surface, not an overlay) and glides to the next active item with the snappy spring. Needs an active item; without one the bar is plain. Reduced motion: the notch and the lift jump.
classNamestringNoneAdds extra classes to the dock bar.
DockLabels keys and English defaults (1)
Pass any key in labels; the rest keep the defaults of defaultDockLabels.
KeyEnglish default
activeopen

DockItem props

PropTypeDefaultDescription
label (required)stringNoneAccessible name, and the label shown above the icon.
icon (required)ReactNodeNoneThe icon (an svg or an image). Sized to ~46% of the tile unless you size it.
hrefstringNoneAddress to open on click: the tile then renders as a link (an anchor) instead of a button.
targetstringNoneLink target, e.g. "_blank".
relstringNoneLink relationship, e.g. "noopener".
renderReactElement<unknown, string | JSXElementConstructor<any>>NoneRender the link as another element, e.g. your router's <Link to="…" />.
onClick((event: MouseEvent<HTMLElement>) => void)NoneCalled when the item is pressed or activated with Enter / Space.
activebooleanfalseOpen app / current page: a dot under the icon. Links get aria-current="page"; buttons add labels.active of the Dock to their accessible name ("Finder, open").
activeLabelstringNoneOverrides the Dock's labels.active for this item (i18n).
badgeReactNodeNoneA count or short text on the corner of the icon.
badgeLabelstringthe badge textWhat screen readers hear for the badge, e.g. "3 unread".
bouncebooleanfalseBounce like a launching app when activated (never with reduced motion).
disabledbooleanfalseDisable the item. It stays focusable, as in any toolbar. A disabled link item renders as a disabled button (a link cannot be disabled).
classNamestringNoneClasses for the item's outer slot (layout, margins).
tileClassNamestringNoneAdds extra classes to the icon tile (background, colour).

DockSeparator props

PropTypeDefaultDescription
classNamestringNoneAdds extra classes to the separator slot.

Keyboard

KeysAction
Tab/Shift + TabEnter or leave the dock once (one tab stop).
Arrow Left/Arrow RightMove between items; the focused item is magnified with its label above.
Home/EndJump to the first or last item.
Enter/SpacePress the focused item.
EscapeHide the labels (WCAG 1.4.13); moving the pointer brings them back.

Accessibility

  • A Base UI toolbar: roving focus, with aria-label on the dock and a name on each item (the label is also its accessible name).
  • Magnification is decorative.
  • Under reduced motion items do not scale; the label still shows on focus.

All exports on this page

  • Dock — Dock: a macOS-style launcher bar.
  • DockItem — One icon in a Dock: a button, or a link when you give it an href (or render your router's <Link>).
  • DockSeparator — A thin divider between groups of items (e.g.
  • defaultDockLabels — The English strings of Dock.

When to use the macOS dock effect

  • Use it as a floating dock with magnification for an app launcher or quick-action bar in a desktop-style web app, where icons near the pointer swell and push neighbors apart like the macOS Dock.
  • Use it as a floating bottom bar in a portfolio or a docs playground, with DockItem links to sections, a DockSeparator before utility items and a badge on an inbox icon.
  • Set side="top" to pin the bar to the top edge instead of the default bottom; icons grow away from that edge and labels appear on the far side. Only top and bottom are supported, so use VerticalNav for a vertical rail.
  • Skip it when you need editor controls or primary site navigation: use Toolbar for formatting controls and Navbar for site navigation, since magnification adds nothing to a menu of text links.
  • Pair it with Dialog or MorphingDialog so an item opens a window-like panel, Badge for status elsewhere in the shell, and DockItem badge for counts; no Tooltip is needed because the dock draws its own labels.

Frequently asked questions

19 effects pages in all: browse them on All effects.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .