VisorVisor
Hooks

useWheelNav

Converts mouse wheel events into debounced section navigation for deck-style presentations.

Usage

useWheelNav({
  containerRef,
  goTo,
  currentIndexRef,
})

Installation

npx visor add use-wheel-nav

Parameters

NameTypeRequiredDefaultDescription
containerRefReact.RefObject<HTMLElement | null>No--Container element to listen on. Falls back to document if not provided.
goTo(index: number) => voidYes--Navigation function that scrolls to the given section index.
currentIndexRefReact.MutableRefObject<number>Yes--Mutable ref holding the current section index.

Returns

This hook does not return a value.