Scrollbar ​

Used to replace the browser's native scrollbar.

Basic usage ​

Use height property to set the height of the scrollbar, or if not set, it adapts according to the parent container height.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

Horizontal scroll ​

When the element width is greater than the scrollbar width, the horizontal scrollbar is displayed.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

Max height ​

The scrollbar is displayed only when the element height exceeds the max height.

1

2

3

Manual scroll ​

Use setScrollTop and setScrollLeft methods can control scrollbar manually.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

Infinite scroll 2.10.0 ​

end-reached is triggered when the scrollbar reaches the end. It can be used as an infinite scroll.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

API ​

Attributes ​

NameDescriptionTypeDefault
heightheight of scrollbarstring / number—
max-heightmax height of scrollbarstring / number—
nativewhether to use the native scrollbar stylebooleanfalse
wrap-stylestyle of wrap containerstring / object—
wrap-classclass of wrap containerstring—
view-stylestyle of viewstring / object—
view-classclass of viewstring—
noresizedo not respond to container size changes, if the container size does not change, it is better to set it to optimize performancebooleanfalse
tagelement tag of the viewstringdiv
alwaysalways show scrollbarbooleanfalse
min-sizeminimum size of scrollbarnumber20
id 2.4.0id of viewstring—
role 2.4.0 a11yrole of viewstring—
aria-label 2.4.0 a11yaria-label of viewstring—
aria-orientation 2.4.0 a11yaria-orientation of viewenum—
tabindex 2.8.3tabindex of wrap containernumber / string—
distance 2.10.5trigger end-reached event distance(px)number0

Events ​

NameDescriptionType
scrolltriggers when scrolling, return distance of scrollingFunction
end-reached 2.10.0triggers when the end of a scroll is triggeredFunction

Slots ​

NameDescription
defaultcustomize default content

Exposes ​

NameDescriptionType
handleScrollhandle scroll eventFunction
scrollToscrolls to a particular set of coordinatesFunction
setScrollTopSet distance to scroll topFunction
setScrollLeftSet distance to scroll leftFunction
updateupdate scrollbar state manuallyFunction
wrapRefscrollbar wrap refobject

Source ​

Component • Style • Docs

Contributors ​