Loading...

Custom scroll bar container.

import { ScrollBox } from '@antv/x6-react-components'
import '@antv/x6-react-components/es/scroll-box/style/index.css'
;<ScrollBox
containerWidth={300}
containerHeight={200}
contentWidth={1200}
contentHeight={3000}
containerStyle={{ border: '1px solid #f0f0f0' }}
contentStyle={{
position: 'relative',
cursor: 'grab',
background:
'linear-gradient(217deg, rgba(255,0,0,.8), rgba(255,0,0,0) 70.71%), linear-gradient(127deg, rgba(0,255,0,.8), rgba(0,255,0,0) 70.71%), linear-gradient(336deg, rgba(0,0,255,.8), rgba(0,0,255,0) 70.71%)',
}}
>
<div style={{ position: 'absolute', top: 8, left: 8 }}>Top-Left-Corner</div>
<div style={{ position: 'absolute', top: 8, right: 8 }}>Top-Right-Corner</div>
<div style={{ position: 'absolute', bottom: 8, left: 8 }}>
Bottom-Left-Corner
</div>
<div style={{ position: 'absolute', bottom: 8, right: 8 }}>
Bottom-Right-Corner
</div>
</ScrollBox>

ScrollBox

ParameterDescriptionTypeDefault Value
containerClassNameContainer style class namestring-
contentClassNameContent style class namestring-
containerStyleContainer styleCSSProperties-
contentStyleContent styleCSSProperties-
containerWidthContainer widthnumber-
containerHeightContainer heightnumber-
contentWidthContent widthnumber-
contentHeightContent heightnumber-
scrollTopPosition of the vertical scrollbarnumber0
scrollLeftPosition of the horizontal scrollbarnumber0
dragableWhether the scrollbar position can be changed by dragging the contentbooleantrue
touchableWhether touch events are supportedbooleantrue
scrollbarAutoHideWhether to automatically hide the scrollbarbooleantrue
scrollbarSizeSize of the scrollbar (height of the horizontal scrollbar, width of the vertical scrollbar)number4
miniThumbSizeMinimum size of the scrollbar thumbnumber16
keyboardScrollAmountAmount of scroll per key press when using keyboard arrow keysnumber40
zIndexnumber-
onVerticalScrollCallback function when the vertical scrollbar is scrolled(scrollTop: number) => void-
onHorizontalScrollCallback function when the horizontal scrollbar is scrolled(scrollLeft: number) => void-
onScrollStartCallback function when scrolling starts(scrollLeft: number, scrollTop: number) => void-
onScrollCallback function during scrolling(scrollLeft: number, scrollTop: number) => void-
onScrollEndCallback function when scrolling ends(scrollLeft: number, scrollTop: number) => void-