Spin-delays a nullable value. Returns null until value stays non-null and unchanged longer than delay; a new value restarts the wait. Once shown, it keeps a value up until at least minDuration after it first appeared. Swapping to another non-null value does not restart minDuration. Call it as useSpinDelay(value, options?).
Use for
a spinner that should not flash or flicker
a pending indicator that stays up long enough to read
Practices
Guidance
Practice
Don’t
Delay a spinner with setTimeout. Use this hook instead.
Don’t
Reach for it inside a button. SubmitButton already spin-delays its spinner.
Options
Prop
Type
Description
delay
number
Wait this long before showing the value. 0 shows it straight away.Default: 150
minDuration
number
Once shown, keep a value up at least this long, counted from when the first value appeared, not from a later swap.Default: 400