useDelay API
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| useDelay | System |
| useTimer | System |
| usePopover | System |
Functions
useDelay
(callback?: ((isOpening: boolean) => void) | undefined, options?: UseDelayOptions) => UseDelayReturnSchedule open and close transitions with configurable delays.
Composes useTimer for the lifecycle (start / stop / pause / resume plus
reactive isActive, isPaused, remaining) and adds direction tracking
(isOpening) and promise-based resolution.
Options
openDelay
MaybeRefOrGetter<number> | undefinedDelay in milliseconds before the opening transition fires.
closeDelay
MaybeRefOrGetter<number> | undefinedDelay in milliseconds before the closing transition fires.
Properties
isOpening
Readonly<Ref<boolean, boolean>>Direction of the pending transition (true = opening, false = closing).
Methods
start
(isOpening: boolean, options?: UseDelayStartOptions) => Promise<boolean>Start a delay in the given direction. Restarts if already running. Resolves
with isOpening once the delay elapses. If start() is called again before
the previous resolves, the previous promise resolves with the new direction.
stop
() => voidCancel any pending delay and reset state. Resolves the pending promise with the current direction.