Build touch interactions with AI
Design dragging and swiping that follow the finger directly, respond to release velocity and remain usable when someone interrupts the motion or uses a keyboard.
To build touch interactions with AI, distinguish movement under a finger from movement after release. A drawer that eases towards the pointer while it is being dragged feels disconnected. The gestures skill guides direct tracking first, then a release controlled by velocity, distance and the intended resting position.
This distinction helps with difficult cases. Someone may flick a sheet a short distance, drag it slowly past a threshold or grab it again during its return. The interface also needs a usable alternative for visitors who cannot perform the gesture.
What it does
- Keep an element aligned with the pointer during an active drag.
- Choose a release or dismissal behaviour using velocity and distance.
- Synchronise the backdrop with the drawer’s current position.
- Handle boundaries and interruption during a return movement.
- Provide a clear close control, keyboard access and appropriate focus behaviour.
Install and use
- Install the skill and supply the component and a working preview. Use the project’s existing gesture tooling or a suitable maintained drawer library where it meets the requirements.
- Ask, “Make this bottom sheet track the finger directly, then test a quick flick, a slow release and grabbing it during the return.”
- Try the result on a touch device and test the keyboard-only route independently.
FAQ
Source
Made by Emil Kowalski. Original skill: gestures, published on GitHub under the MIT licence.
View on GitHub