createPress
Whether an element is pressed: true while a pointer is held down on it, or Enter or Space is held while it has focus, and false once it's released or the press is cancelled. To animate while it's pressed, give the element whileTap.
import { createPress } from "@wardic/solid/unstable/v2"
const pressed = createPress()
<button ref={pressed}>{pressed() ? "Holding" : "Press and hold"}</button>On Solid 1, createPress(target) takes the element itself, so call it where the element exists, as createHover does. On Solid 2, createPress() is a sensor, given to the element's ref.
An element that takes no focus of itself, such as a div, is given tabindex="0", so a keyboard can press it. On a server, and until the first press, it's false.
It brings the press Feature.
Coming from Motion
Motion has no press hook: it has whileTap and the tap callbacks, which Wardic has too. Motion's tap answers Enter on a focused element; Wardic's answers Space too.