Magnetic Button
A button that leans toward the pointer as it approaches and springs back when it leaves, its label floating above the surface.
2 variantsProNew
Preview
Preview
Installation
Magnetic Button is part of Floret Pro. It follows Floret's theme tokens, so light and dark mode work out of the box.
Floret ProPro
Your license unlocks this component and all of its source. Sign in once, then install it with the CLI. Follow the steps below.
Sign in with your license
Paste the key from your purchase email. Once per computer.
pnpm dlx @shipped-ui/floret login <license-key>Add Magnetic Button
The CLI checks your license, then copies the source with every dependency and theme token.
pnpm dlx @shipped-ui/floret add magnetic-button
Already bought? Manage your license
Get ProUsage
Pass your own data and wire the callbacks to your app.
import { MagneticButton } from "@/components/ui/magnetic-button";
export function Hero() {
return <MagneticButton onClick={() => start()}>Get started</MagneticButton>;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| strength | number | 14 | How far, in px, the button may travel toward the pointer. |
| radius | number | 48 | Extra reach around the button, in px, where the pull starts. |
| className | string | — | Merged onto the button. |