Preview
Props
Install
npx shadcn@latest add @evilbuttons/stickyUsage
import StickyButton from "@/components/evil-buttons/sticky";
export function ButtonDemo() {
return <StickyButton>Launch</StickyButton>;
}Variants
Clingy
A wider field and a stronger pull make the button chase the cursor from far away.
Subtle
A tight field with no tilt, for a gentle magnetic nudge.
Props
The component spreads native button props and forwards its ref to the button.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | The button label or content. |
radius | number | 120 | Distance in px beyond the button's edge where the pull starts. |
strength | number | 0.45 | How far the body follows the cursor, as a fraction of the cursor offset. |
parallax | number | 0.35 | How far the label drifts inside the body, from 0 (fixed to the body) to 1 (the edge of its padding). |
tilt | number | 8 | Maximum tilt in degrees while the body is pulled. |
className | string | - | Extra classes passed to the button. |
Good to know
- The pull fades smoothly to zero at the field's edge.
- Runs on motion values, with no re-renders on pointer move.