Getting started
Getting started
Install the package and turn any button into a hold. Your code decides what happens after.
Install
npm install @reuse-sh/interactionsUse it
The browser module works without a framework. In React, the component creates the same controller when it mounts and destroys it when it unmounts.
import { createHoldToConfirm } from "@reuse-sh/interactions";
import "@reuse-sh/interactions/styles.css";
const hold = createHoldToConfirm(button, {
holdMs: 1200,
onConfirm: () => removeDraft(),
});import { HoldToConfirmButton } from "@reuse-sh/interactions/react";
import "@reuse-sh/interactions/styles.css";
<HoldToConfirmButton holdMs={1200} onConfirm={removeDraft}>
Hold to remove
</HoldToConfirmButton>