Magnetic Cta
MotionA magnetic button that drifts toward the cursor on a spring and snaps back on leave. Takes all Button props plus a strength value; static for reduced motion.
src/registry/premium/magnetic-cta.tsx/r/magnetic-cta.json
Hover me
Installation#
bash
npx shadcn@latest add @minidev/magnetic-cta
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/magnetic-cta.json
Usage#
tsx
import { MagneticCta } from "@/components/ui/magnetic-cta"
export function Example() {
return (
<MagneticCta size="lg" className="w-full max-w-sm sm:w-auto">Feel the CTA</MagneticCta>
)
}
API reference#
| Prop | Type | Default |
|---|---|---|
strength | number | 28 |
Also accepts every prop of Button props, passed through to the root element.
Dependencies#
npm
motion
Built from
Examples#
Related buttons components#
Button GroupGroups adjacent buttons into one segmented control in Tailwind, joining borders and rounding only the outer corners. Uses role group for toolbars.ButtonShadcn compatible React button on Base UI with eight variants, nine sizes including icon sizes, a pressed state and render prop support for links.Copy ButtonReact copy to clipboard button that writes a value, then swaps to a check icon and Copied label for a moment. Accepts every Button variant and size.Floating Action ButtonA round primary button fixed to the bottom right corner of the viewport for the main action on a screen. Accepts every Button prop, including icons.Icon ButtonA square React button for icon only actions in small, default and large sizes with every Button variant. Its aria-label prop is required, so it is always named.Split ButtonSplit button with a primary action and a chevron that opens a dropdown of secondary actions, including destructive items. The menu matches the button width.
All button components