Skip to content

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Scrollbar API

Scrollbar 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

Scrollbar Events

NameDescriptionType
scrollTriggers when scrolling, return distance of scrollingFunction

Scrollbar Slots

NameDescription
defaultCustomize default content

Scrollbar 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