Skip to content

A React component to make element scrollable with custom scrollbar

Notifications You must be signed in to change notification settings

silent181/scrollable

Repository files navigation

Scrollable

A React component to make element scrollable with custom scrollbar

usage

  • Wrap your element with <Scrollable> component

  • Total length depends on all child elements of your root element, and viewport length is your root element length

  • Do not forget to set width and height explicitly to your root element so our lib can get this info more precisely, you can use html attributes or dataset to do this.

  • if your element is flex container, it must have these preset properties:

    • flex-wrap: no-wrap , this property defaults to be true,
    • flex-direction: column when you want to scroll vertically
    • Each flex item must have flex-shrink: 0 property
  • If you want to wrap a custom react component, don't forget to pass ref to your root node through forwardRef method, see details in the example

example

git clone https://github.com/silent181/scrollable

cd scrollable

npm i

npm run dev

About

A React component to make element scrollable with custom scrollbar

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published