Magnet Cluster
A grid of tiles that lean toward the pointer and settle back.
PROGet Magnet Cluster and 168 other Pro components with pro lifetime — Get Pro
- Category
- Creative
- Access
- ProPro · unlocked
- Source
- 256 lines · one file
- States
- 5 drawn
The decision inside it
The field is shared, the response is local
The cluster moves like iron filings under one magnet, not a row of separate hover effects. The pull falls off smoothly and is capped at a few pixels, so the grid stays readable and nothing slides away from a click. Reduced motion keeps it still.
When to use it
Use Magnet Cluster for a grid of integrations or features that responds to the pointer: nearby tiles light up and lean toward it.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Magnet Cluster for this.
Install it: npx shadcn@latest add @liro/magnet-cluster
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/magnet-cluster.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { Calendar, Mail, MessageSquare } from "lucide-react";
import { MagnetCluster } from "@/components/ui/magnet-cluster";
const items = [
{ id: "mail", label: "Mail", icon: <Mail /> },
{ id: "calendar", label: "Calendar", icon: <Calendar /> },
{ id: "chat", label: "Chat", icon: <MessageSquare /> },
];
export function Integrations() {
return <MagnetCluster items={items} columns={3} labels="always" />;
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
items | MagnetItem[] | Yes | – |
columns | number | No | Tiles per row. Default 6. |
radius | number | No | Reach of the pull, in px. Default 180. |
strength | number | No | Largest lean, in px. Default 10. |
labels | "hover" | "always" | No | Show each label on hover only, or always under its icon. Default `hover`. |
Dependencies
npm packages
clsxframer-motiontailwind-mergeLiro foundations, installed alongside it
liro-themeStates
All of them are drawn by the component. None is left for you to design.
- Rest
- Pulled
- Hovered
- Focused
- Reduced motion
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances