Dock
Icons swell around the cursor and settle back on a spring. Navigation.
Open playgroundAbout
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
npm i @ashutoshswamy/smouiUsage
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.
numberdefault48- magnify
Peak icon size under the cursor.
numberdefault84- className
Class on the toolbar.
string
More navigation components
- BreadcrumbsA trail that folds its middle into an ellipsis. Press it and the hidden crumbs spring out in order.
- FlyoutNavOne panel that follows you. Move between items and it glides sideways and resizes to the new content while the content cross-fades.
- GooMenuA plus that throws its items out as liquid bubbles and fuses them back on close.
- MorphTooltipOne tooltip for the whole toolbar. It stretches to the next tool and resizes to its label.
- PaginationOne accent pill slides to the page you pick. Long lists fold into ellipses that follow the current page.
- PillNavPill whose highlight stretches toward the item you pick.