@aiquants/swipe-overlay
v0.1.0
Published
React hooks and context for swipe-to-dismiss overlay interactions
Readme
@aiquants/swipe-overlay
React hooks and context for swipe-to-dismiss overlay interactions.
Features
- Swipe to dismiss: Smooth swipe gestures to close overlays
- Touch & Mouse support: Works with both touch devices and mouse interactions
- Configurable thresholds: Customize swipe thresholds and velocity
- TypeScript support: Fully typed for better developer experience
Installation
pnpm add @aiquants/swipe-overlayUsage
import { useSwipeOverlay } from '@aiquants/swipe-overlay'
const MyOverlay = () => {
const { overlayRef, overlayStyle, attemptClose } = useSwipeOverlay({
onClose: () => console.log('Closed'),
isOpen: true
})
return (
<div ref={overlayRef} style={overlayStyle}>
Content
</div>
)
}