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.
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.
overflow="y"overflow="x"overflow="both"Expanded
Keeps the track, thumb and arrows visible.
Size
size sets the expanded scroll bar to thin, medium (default) or large.
thinmediumlargeExisting 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.
neverscrollleavemoveArrows
Hides the arrow buttons.
Hidden track
Hides the track when the scroll bar expands.
Keyboard and accessibility
The scrolling area is focusable and scrolls with the keyboard. Name it with viewportAttributes.
Component Props
| Name | Type | Default | Description |
|---|---|---|---|
as | 'div' | 'section' | 'article' | 'aside' | 'main' | 'nav' | 'ul' | 'ol' | 'div' | The element to render. |
ref bindable | HTMLElement | The root element. | |
scrollRef | HTMLElement | null | An existing element to add the scroll bars to instead of rendering one. | |
viewportRef bindable | HTMLElement | null | The element that scrolls. | |
viewportAttributes | HTMLAttributes<HTMLDivElement> | Attributes for the element that scrolls. | |
expanded | boolean | Keeps the scroll bar expanded. | |
collapseDelay | number | 2000 | Milliseconds to wait before collapsing after the pointer leaves. |
instance bindable | OverlayScrollbars | null | The OverlayScrollbars instance. | |
overflow | 'auto' | 'x' | 'y' | 'both' | 'auto' | The axes that can scroll. |
autoHide | 'never' | 'scroll' | 'leave' | 'move' | 'move' | When the scroll bar hides. |
autoHideDelay | number | 1000 | Milliseconds to wait before hiding. |
hideArrows | boolean | Hides the arrow buttons. | |
showFocusOutline | boolean | Shows the focus outline of the scrolling area. | |
hideTrack | boolean | Hides the track. | |
size | 'thin' | 'medium' | 'large' | 'medium' | The size of the expanded scroll bar. |
arrowStep | number | 48 | Pixels scrolled per arrow press. |
options | PartialOptions | Extra OverlayScrollbars options. | |
events | EventListeners | OverlayScrollbars events. | |
defer | boolean | IdleRequestOptions | Initializes when the browser is idle. | |
| HTML Attributes |

