Magnetic Orb
betaA round arrow button pulled toward the pointer on a spring, glowing in the accent colour as it is approached.
- Effects & motion
- 1 file
- 1 npm package
- Accessibility notes
Loading the example…
pnpm dlx @dowel-ui/cli add magnetic-orbnpm packages installed: class-variance-authority.
import { MagneticOrb } from "@/components/ui/magnetic-orb";Default
Demo
Accents
<MagneticOrb>
| Prop | Type | Default |
|---|---|---|
fieldClassNameClasses for the invisible field the pointer is tracked in. | string | — |
iconThe glyph. Defaults to an arrow that mirrors in right-to-left layouts. | ReactNode | — |
reachHow far beyond its edge the pull reaches, in pixels. | number | 32 |
size | "sm" | "md" | "lg" | "md" |
strengthHow far the orb follows the pointer, as a fraction of the distance (0–1). | number | 0.35 |
Plus every attribute of <button>.
A native <button>, so Enter and Space activate it and it shows the shared focus ring. It is icon-only: its name defaults to "Continue" and should be set with aria-label to say where it goes. The arrow is aria-hidden and mirrors in right-to-left layouts. The magnetic pull is pointer-only decoration: it is skipped for touch and pen input and under reduced motion, and the colour change also appears on keyboard focus so it never depends on a mouse.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes