enes

ScrollBar

A ScrollBar lets users scroll content that overflows its container. At rest it shows a thin thumb over the content; on hover it expands into a track with arrows.

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

Paragraph 5. Hover the scroll bar to expand it.

Paragraph 6. Hover the scroll bar to expand it.

Paragraph 7. Hover the scroll bar to expand it.

Paragraph 8. Hover the scroll bar to expand it.

Usage

<script>
  import { ScrollBar } from 'fluentui-svelte';
</script>

<ScrollBar style="height: 12rem;" viewportAttributes={{ 'aria-label': 'Article' }}>
  <!-- Long content -->
</ScrollBar>

Overflow

overflow sets the axes that scroll: auto (the default, only the axes that overflow), y, x or both.

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

Paragraph 5. Hover the scroll bar to expand it.

Paragraph 6. Hover the scroll bar to expand it.

Paragraph 7. Hover the scroll bar to expand it.

Paragraph 8. Hover the scroll bar to expand it.

overflow="y"
1
2
3
4
5
6
7
8
9
10
11
12
overflow="x"
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
overflow="both"

Expanded

Keeps the track, thumb and arrows visible.

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192

Size

size sets the expanded scroll bar to thin, medium (default) or large.

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

Paragraph 5. Hover the scroll bar to expand it.

Paragraph 6. Hover the scroll bar to expand it.

Paragraph 7. Hover the scroll bar to expand it.

Paragraph 8. Hover the scroll bar to expand it.

thin

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

Paragraph 5. Hover the scroll bar to expand it.

Paragraph 6. Hover the scroll bar to expand it.

Paragraph 7. Hover the scroll bar to expand it.

Paragraph 8. Hover the scroll bar to expand it.

medium

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

Paragraph 5. Hover the scroll bar to expand it.

Paragraph 6. Hover the scroll bar to expand it.

Paragraph 7. Hover the scroll bar to expand it.

Paragraph 8. Hover the scroll bar to expand it.

large

Existing element

Adds the scroll bars to an existing element instead of rendering one.

  • Item 1
  • Item 2
  • Item 3
  • Item 4
  • Item 5
  • Item 6
  • Item 7
  • Item 8

Auto-hide

Controls when the scroll bar hides.

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

never

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

scroll

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

leave

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

move

Arrows

Hides the arrow buttons.

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

Paragraph 5. Hover the scroll bar to expand it.

Paragraph 6. Hover the scroll bar to expand it.

Paragraph 7. Hover the scroll bar to expand it.

Paragraph 8. Hover the scroll bar to expand it.

Hidden track

Hides the track when the scroll bar expands.

Paragraph 1. Hover the scroll bar to expand it.

Paragraph 2. Hover the scroll bar to expand it.

Paragraph 3. Hover the scroll bar to expand it.

Paragraph 4. Hover the scroll bar to expand it.

Paragraph 5. Hover the scroll bar to expand it.

Paragraph 6. Hover the scroll bar to expand it.

Paragraph 7. Hover the scroll bar to expand it.

Paragraph 8. Hover the scroll bar to expand it.

Keyboard and accessibility

The scrolling area is focusable and scrolls with the keyboard. Name it with viewportAttributes.

Component Props

NameTypeDefaultDescription
as'div' | 'section' | 'article' | 'aside' | 'main' | 'nav' | 'ul' | 'ol''div'The element to render.
ref bindableHTMLElementThe root element.
scrollRefHTMLElement | nullAn existing element to add the scroll bars to instead of rendering one.
viewportRef bindableHTMLElement | nullThe element that scrolls.
viewportAttributesHTMLAttributes<HTMLDivElement>Attributes for the element that scrolls.
expandedbooleanKeeps the scroll bar expanded.
collapseDelaynumber2000Milliseconds to wait before collapsing after the pointer leaves.
instance bindableOverlayScrollbars | nullThe OverlayScrollbars instance.
overflow'auto' | 'x' | 'y' | 'both''auto'The axes that can scroll.
autoHide'never' | 'scroll' | 'leave' | 'move''move'When the scroll bar hides.
autoHideDelaynumber1000Milliseconds to wait before hiding.
hideArrowsbooleanHides the arrow buttons.
showFocusOutlinebooleanShows the focus outline of the scrolling area.
hideTrackbooleanHides the track.
size'thin' | 'medium' | 'large''medium'The size of the expanded scroll bar.
arrowStepnumber48Pixels scrolled per arrow press.
optionsPartialOptionsExtra OverlayScrollbars options.
eventsEventListenersOverlayScrollbars events.
deferboolean | IdleRequestOptionsInitializes when the browser is idle.
HTML Attributes
Edit this Doc View as Markdown