useScroller

Know whether a scrollable row can scroll further and scroll it by a step, for carousels and tab lists.

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

General

The buttons are disabled when the row cannot scroll further.

APIs

useScroller

const useScroller = <T extends HTMLElement = HTMLElement>(
  step?: number,
) => {
  ref: RefObject<T | null>
  canScrollStart: boolean
  canScrollEnd: boolean
  scrollBy: (direction: 'start' | 'end') => void
}
Edit this page on GitHub