useScrollIntoView

Scroll smoothly to an element, in the page or inside a container.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Scroll the box down to the last item.

APIs

useScrollIntoView

const useScrollIntoView = <
  T extends HTMLElement = HTMLElement,
  C extends HTMLElement = HTMLElement,
>(options?: { duration?: number; offset?: number }) => {
  targetRef: RefObject<T | null>
  scrollableRef: RefObject<C | null>
  scrollIntoView: () => void
  cancel: () => void
}
Edit this page on GitHub