Description
react-tappable is a React component that handles touch, tap and press events so that buttons behave like native controls. By default it renders a span and binds touch handling to it, providing onTap, onPress and pinch events. The pressed state is shown by adding an active or inactive class to the base class, so you can style it in CSS. If the touch moves far from the element, the pressed state is cancelled and returns if the touch comes back. Scrolling a parent element cancels the touch, and when an onPress handler is set, the touch is cancelled once the press happens. Where touch events are not supported, the component falls back to mouse events, and keyboard events are emulated to match native button behavior. The README explains how to turn off default handling, such as scrolling, with a preventDefault prop, and it describes lighter builds if you only need some features. The package installs from npm, and a live demo is linked from the README. It is aimed at React developers building touch interfaces.…
Highlights
- onTap, onPress and pinch events
- Active and inactive classes for pressed styling
- Cancels taps when the user scrolls
- Falls back to mouse and keyboard events
- Install from npm, lighter builds available
Ratings & Reviews
No ratings yet
Be the first to rate react-tappable.
People also visit
react-tappable FAQ
What is react-tappable?
A React component that handles touch, tap and press events so that buttons behave like native controls.
How do I install it?
Install it from npm. The README also explains a standalone build for pages that already include React globally.
Does it work with a mouse and keyboard?
Yes. It falls back to mouse events when touch is not supported, and it emulates native keyboard button behavior.
How do I style the pressed state?
The component adds -active or -inactive to its base class, so you can style the pressed state in CSS.
How do I turn off default touch handling?
Set the preventDefault prop to disable default event handling such as scrolling.
What are the best react-tappable alternatives?
Popular alternatives to react-tappable include react-tapper, react-hammerjs and rc-hammerjs. See all react-tappable alternatives



















