useIdleTimeout

Hook that calls back after a period without pointer or keyboard activity, so the app ends the session.

useIdleTimeout(15 * 60_000, () => signOut("idle"));

Installation

Once per app, set up Aedis UI. The CLI verifies the signed release before writing anything and pins every dependency:

npx @aedis/cli@0.1.0 init

Import the theme once in your global CSS, after Tailwind:

app/globals.css
@import "tailwindcss";@import "./styles/aedis-theme.css";

Then add the component:

npx @aedis/cli@0.1.0 add use-idle-timeout# pnpm dlx @aedis/cli@0.1.0 add use-idle-timeout · yarn dlx @aedis/cli@0.1.0 add use-idle-timeout · bunx @aedis/cli@0.1.0 add use-idle-timeout

Props

PropTypeDefaultDescription
msnumber—Idle period in milliseconds.
onIdle() => void—Called once per idle period; sign out and clear state here.
enabledbooleantrueOff while signed out.

Security

  • A tab that comes back into view past the limit fires at once, so a laptop that slept does not keep a live session.
  • Ending the session is the app's job: revoke it on the server, not only in the browser.