Tech Store

Showing suggestions.

Opening the store's index…
↑↓ to move↵ to openesc to close
Tech Store search
Componentv1.0.0~5.2 KB gzipped

Magnify Dock

A frosted-glass dock whose icons swell under the pointer while their neighbours glide aside

FreeFree
Format

.zip · HTML / CSS / JS · v1.0.0

Free — no account, no email. Always the newest version.

Live preview

Version
Preview width
Zoom

About

The dock everyone wants to touch, for your own site. Glide the pointer along it and the icons swell like a lens is passing over them, while their neighbours slide aside to make room — the frosted panel stretches with them. Click one and it bounces, like an app starting up.

  • The swell follows the pointer and is eased every frame, so it feels soft and never jitters
  • Sits on any edge: across the bottom or top, or down the left or right side
  • Tooltip labels, running dots, separators and count badges built in
  • The script only writes sizes; CSS draws everything, so it stays smooth and cheap
  • Nothing to install: one CSS file and one small script, or one React file

Features

  • Icons swell smoothly around the pointer and their neighbours make room — no jitter, no overlap
  • Cosine or gaussian swell, with the size, reach and softness yours to set
  • Bottom, top, left or right: the icons grow away from the edge, tooltips point the other way
  • Tooltip labels, a launch bounce on click, running dots, separators and count badges
  • Items are real links and buttons, any number per page
  • Plain HTML/CSS/JS and React (Next.js ready) builds
  • Zero dependencies, about 5 KB gzipped (script and styles together)

How to use it

Link the stylesheet and the script once, then build the dock from links and buttons. Each item has its label first, then its icon:

HTML
<link rel="stylesheet" href="magnify-dock.css" />
<script src="magnify-dock.js" defer></script>

<div class="magnify-dock" data-magnify-dock aria-label="Apps">
  <a class="magnify-dock__item" href="/files" data-running>
    <span class="magnify-dock__label">Files</span>
    <span class="magnify-dock__icon"><svg aria-hidden="true">…</svg></span>
  </a>
  <button class="magnify-dock__item" type="button">
    <span class="magnify-dock__label">Mail</span>
    <span class="magnify-dock__icon"><svg aria-hidden="true">…</svg><span class="magnify-dock__badge">3</span></span>
  </button>
  <span class="magnify-dock__separator"></span>
  <button class="magnify-dock__item" type="button">…</button>
</div>

Options as data attributes on the dock: data-edge (bottom by default, or top, left, right), data-magnify-dock-max-scale (1.8 — how big the icon under the pointer gets; 1 turns the magnifier off), data-magnify-dock-range (160, in px — how far from the pointer icons still grow), data-magnify-dock-curve (cosine or gaussian, peakier), data-magnify-dock-smoothing (0.22 — how much of the way an icon goes each frame; lower is softer) and data-magnify-dock-bounce="false" to skip the launch bounce.

On an item: data-running shows the indicator dot; so do aria-current="page" on a link and aria-pressed="true" on a toggle button. To change a count later: MagnifyDock.setBadge(item, 5) (0 removes it, past 99 it shows "99+"). Docks added after the page loads: MagnifyDock.init(container) — it returns a function that undoes it.

The dock gets role="toolbar" unless you give it a role, so give it an aria-label.

Ask about this product

Not sure it fits your project? Ask — the answer comes from this page.

Answers are written by AI from this page and can be wrong. The page itself is what counts.

Changelog

  1. 1.0.0First releaseLatest

    Plain HTML/CSS/JS and React builds. Smooth pointer magnification with neighbours making room, four edges, tooltips, launch bounce, running dots, badges, keyboard, touch and reduced-motion support.

  2. Fixes and new features land behind the same download, which always serves the latest version.
  • ComponentNavigation

    Animated Tabs

    Tabs with a glass pill that stretches from tab to tab, and panels that slide the same way

    Free