r/reactjs • • Oct 30 '26

Show /r/reactjs Made a React button that tilts, squishes and actually feels pressable

Hi!! I've been working on a small React component that makes buttons feel physical, like you're actually pushing something down.

Live demo: https://react-tilt-button.vercel.app/

What it does:

  • Tilts toward your cursor (and follows your finger on mobile)
  • Sinks and squishes when you press, then springs back
  • Has real depth, with a side wall that holds up at any radius, even pills
  • Clamps your props so it never visually breaks, whatever values you throw at it
  • Optional glare that moves with your pointer

No dependencies, about 6KB gzipped with the CSS. There are a few style variants and spring presets (bouncy, jelly, snappy, stiff) if you don't want to tune everything yourself.

It was inspired by react-awesome-button, which I really liked, but I wanted something smaller that felt more physical, so I built this one from scratch. It tilts toward wherever your pointer actually is, the press runs on springs, and it's just the button with nothing else bundled in.

npm install react-tilt-button

It's still a work in progress and I'm sure there are edge cases. It's open source, so issues and PRs are very welcome 🙂

Would really love feedback, especially on how it feels on mobile and whether the props make sense.

GitHub: https://github.com/archisvaze/react-tilt-button

58 Upvotes

18 comments sorted by

6

u/moltar Oct 30 '26

Looks and feels slick. Great for games.

One small bug - drag off to cancel on mobile doesn’t work - still activates.

1

u/archeese4 Oct 30 '26

Thanks!! I’ll fix that!

1

u/witness_smile Oct 30 '26

Works for me on latest iOS, maybe an Android-specific thing?

2

u/moltar Oct 30 '26

I’m on iOS too. It kinda works. But the whole page scrolls with the drag. Making it unclear that I dragged away from the button.

1

u/boobyscooby Oct 30 '26

Drag to side works, drag down refreshes page drag up works. Its fine

1

u/moltar Oct 30 '26

Drag up scrolls the page for me

2

u/Yourmamauw 29d ago

Has a squishy feel and look that makes me want to keep clicking

2

u/archeese4 28d ago

Lol that was the point 😉

3

u/Relative_Rooster_848 Oct 30 '26

Pretty sleek ngl

3

u/nameupp Oct 30 '26

ngl 6kb with zero deps is super clean. checked the demo on mobile and the spring physics feel great, but did you handle touch-action: manipulation or cancel pointer tracking when the user starts vertical scrolling? ran into an issue where dragging to scroll halfway down the page sometimes triggers the squish state. tbh adding a prefers-reduced-motion check to kill the tilt would make it an instant drop-in for production imo

2

u/Spleeeee Oct 30 '26

Pretty swag.

2

u/theofficialnar Oct 30 '26

Damn makes me want to actually play with it lmao

1

u/jmtucu 28d ago

Looks really nice, well done!

11

u/[deleted] Oct 30 '26

[removed] — view removed comment

3

u/br1anfry3r Oct 30 '26

Yeah, actually. That was pretty impressive