Use it for one consequential action that deserves a deliberate gesture: hold the key (pointer, Space or Enter) until it snaps and latches, then onConfirm fires. Keep it latched with confirmed and resetMs={null}.
When not to use
Not for frequent or low-risk actions such as save or next, where a hold gets in the way. For a danger zone that shows what will be lost use Keyline.
import { DeepPress } from "@/components/effects/deep-press"export function Deploy() { return ( <DeepPress confirmLabel="Deploying" onConfirm={() => console.log("deploy")}> Hold to deploy </DeepPress> )}
className goes on the outer wrapper, so w-full makes the key full width. Leave room under the key for the hint, about 2rem.
To keep the key latched until you decide, control the state with confirmed and onConfirmedChange and set resetMs={null}. The key stays down until confirmed goes false:
const [confirmed, setConfirmed] = useState(false)<DeepPress confirmLabel="Deploying" confirmed={confirmed} onConfirmedChange={setConfirmed} resetMs={null} onConfirm={startDeploy}> Hold to deploy</DeepPress><button type="button" onClick={() => setConfirmed(false)}> Cancel deploy</button>
holdMs sets the time to reach the bottom (900 by default). 60% of the travel happens in the first 35% of the time, then it gets harder.
Travel is 8, 10 or 12 px by size.
At the bottom there is a snap and onConfirm fires. The key stays latched at 85% of the travel and rises after resetMs (1800 by default).
Releasing early makes the key rise and pass rest by up to 2 px, proportional to the depth reached. Nothing happens. A very short tap shudders the key and shows hint.
On touch, a long press holds the key. Moving more than 8 px or scrolling cancels. The context menu is disabled and the target is at least 44 px.
Color props take any CSS color: hex, RGB, HSL or OKLCH.
<DeepPress confirmLabel="Deploying" color="#f2b84b" wallColor="#9c6a12" confirmColor="#3ddc97" textColor="#2a1c04" confirmTextColor="#06281b"> Hold to deploy</DeepPress>
No travel: the border fills while the key is held and the change of state is a fade. The component reads usePrefersReducedMotion, so the MotionKitProvider setting applies too.