Loading preview
Glow Grid
CardsCards whose borders light up near the pointer, as if a light moved across them.
Wraps any element so it is pulled toward the mouse pointer and springs back.
npx shadcn@latest add @venusui/magneticRun this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/ui/magnetic.tsxThe code behind the preview above.
magnetic-demo.tsx
import { ArrowUpRight } from "lucide-react"
import { Magnetic } from "@/components/ui/magnetic"
export default function MagneticDemo() {
return (
<Magnetic>
<button
type="button"
className="inline-flex h-11 items-center gap-2 rounded-full border bg-card px-5 text-sm font-medium transition-colors hover:bg-muted"
>
Get in touch
<ArrowUpRight className="size-4" />
</button>
</Magnetic>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | The element to make magnetic, e.g. a button. Required. |
| strength | number | 0.35 | How far it follows the pointer, from 0 to 1. |
| range | number | 24 | Extra space around the element, in pixels, where the pull starts. |
| className | string | — | Classes for the wrapper. |
Only the props above.
motion package. The CLI installs it.strength (0.15–0.25) for buttons and a larger one for icons or cursors.range so the pull starts further away from the element.range if it overlaps neighbours.Unknown registry "@venusui"npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.No components.json foundnpx shadcn@latest init in your project first.Cards whose borders light up near the pointer, as if a light moved across them.
A card with a soft light that follows the pointer.
Cards arranged in a ring that turns in 3D, with buttons, arrow keys and announcements.