Next.js
App Router with a client boundary.
Install
Wrap children in app/layout.jsx with InteractionRoot. Import optional CSS from your root layout.
npm install subtlyInitialize
app/interaction-root.jsx
"use client";import { useEffect, useRef } from "react";import { createInteractions } from "subtly";export default function InteractionRoot({ children }) { const root = useRef(null); useEffect(() => { const ix = createInteractions({ root: root.current }); ix.start(); return () => ix.stop(); }, []); return <div ref={root}>{children}</div>;}Use a behavior
<div data-ix="hover-intent" data-ix-hover-delay="150"> <button type="button">Preview</button></div>Use the shared HTML attributes, or import programmatic helpers inside your framework lifecycle. State and visual rendering stay in your component.
Lifecycle and accessibility
Only instantiate DOM utilities in client effects. Do not duplicate the framework’s Link prefetch behavior.
Use a single runtime per root; do not overlap roots. Keep native button semantics, focus and click support. For cleanup, call each utility’s returned callback or destroy method.
Try the same behavior
A clearer home for your next release.
In progressPreview closed. Hover, focus or click to open.
The live example uses native JavaScript; the framework snippets are integration recipes, not separately compiled framework applications.