useSpinDelay
Prevents loading indicator flashes by delaying appearance and enforcing a minimum display duration.
Loading preview...
The useSpinDelay hook smooths loading states by waiting delay milliseconds before returning true (so fast requests under the threshold never show a spinner) and keeping the spinner visible for at least minDuration milliseconds once shown to avoid jarring flickers.
Installation
Usage
Examples
Preventing Spinner Flash on Fast Network Requests
Wrap your isLoading boolean with useSpinDelay before rendering a skeleton or spinner.
Customizing Thresholds for Instant Feedback vs. Background Sync
Use a shorter delay and longer minDuration for primary page transitions so the loading skeleton feels intentional once triggered.
API Reference
SpinDelayOptions
Timing thresholds for delaying and sustaining the loading state.
Property
Specification
delay?numberdefault:500
Delay in milliseconds before showing the spinner
Full Signature
minDuration?numberdefault:200
Minimum duration in milliseconds the spinner stays visible once shown
Full Signature
ssr?uniondefault:true
Immediately show the spinner during SSR when
loading is trueFull Signature