Skip to main content

ScrollContainer

import { ScrollContainer } from 'react-indiana-drag-scroll';
import 'react-indiana-drag-scroll/dist/style.css'

export const Example = () => {
return (
<ScrollContainer>
{/* scrollable content */}
</ScrollContainer>
)
};

Props

PropTypeDescriptionDefault
hideScrollbarsbooleanHide the scrollbarstrue
childrenReactNodeThe content of the scrolling container
onScroll() => voidInvoked when user scrolls the container
onEndScroll() => voidInvoked when scrolling is over completely
onStartScroll() => voidInvoked when scrolling starts
componentElementTypeThe component used for the root node.'div'
classNamestringThe custom classname for the container
styleCSSPropertiesThe custom styles for the container
refElementTypeThe ref to the root node (experimental alternative to getElement)
mouseScrollConfiguration, booleanThe configuration of mouse scroll. The object's fields is described belowtrue

Configuration

FieldTypeDescriptionDefault
rubberBandbooleanThe flag that indicates that rubber band effect should be enabledtrue
inertiabooleanThe flag that indicates that inertial effect should be enabledtrue
overscrollbooleanThe flag that indicates that overscroll effect should be enabled (experimental)false
cursorbooleanThe flag that indicates that cursor should be changed on dragtrue
activationDistanceNumberThe distance that distinguish click and drag start10
ignoreElementsstringSelector for elements that should not trigger the scrolling behaviour (for example, ".modal, dialog" or "*[prevent-drag-scroll]")
buttonsnumber[]The list of mouse button numbers that will activate the scroll by drag[1]