Dock

Icons swell around the cursor and settle back on a spring. Navigation.

Open playground

About

Dock is a React component in the Navigation category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Dock } from "@ashutoshswamy/smoui" and set items, size, magnify among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Dock } from "@ashutoshswamy/smoui";
import { HomeIcon, SwatchIcon } from "@heroicons/react/24/outline";

<Dock
  items={[
    { label: "Home", icon: <HomeIcon width={22} height={22} /> },
    { label: "Palette", icon: <SwatchIcon width={22} height={22} /> },
  ]}
/>

Props 4

items

Dock entries. Label doubles as the accessible name.

{ label: string; icon: ReactNode; onClick?: () => void }[]
size

Resting icon size in px.

numberdefault 48
magnify

Peak icon size under the cursor.

numberdefault 84
className

Class on the toolbar.

string