use-idle
Detects if the user does nothing on the page
Source
Docs
PackageIcon
Usage
The use-idle hook detects if the user does nothing for a given time in milliseconds:
Current state: idle
Custom events
By default, the hook will listen to keypress, mousemove, touchmove, wheel, click, and scroll events to set the idle status.
To change that, provide a list of events in the options argument:
Current state: idle
Initial state
By default, the hook will return an idle state.
To change this, provide an initial state value in the options argument:
Current state: not idle
Definition
Exported types
The UseIdleOptions type is exported from @mantine/hooks;