Leave Yamada UI a star

Star
Yamada UIYamada UIv1.6.4

useIdle

useIdle is a custom hook that detects whether the user has been idle for a certain amount of time in milliseconds.

Source@yamada-ui/use-idle

Import

import { useIdle } from "@yamada-ui/react"
Copied!

Usage

Editable example

const idle = useIdle(2000)

return (
  <Box
    bg={idle ? "blue.500" : "red.500"}
    p="md"
    rounded="md"
    color="white"
    transitionProperty="all"
    transitionDuration="slower"
  >
    Current state: {idle ? "idle" : "not idle"}
  </Box>
)
Copied!

Edit this page on GitHub

PrevioususeHoverNextuseInfiniteScroll