Skip to content

Scroll Area

Line 1 — scroll to see the custom scrollbar.

Line 2 — scroll to see the custom scrollbar.

Line 3 — scroll to see the custom scrollbar.

Line 4 — scroll to see the custom scrollbar.

Line 5 — scroll to see the custom scrollbar.

Line 6 — scroll to see the custom scrollbar.

Line 7 — scroll to see the custom scrollbar.

Line 8 — scroll to see the custom scrollbar.

Line 9 — scroll to see the custom scrollbar.

Line 10 — scroll to see the custom scrollbar.

Line 11 — scroll to see the custom scrollbar.

Line 12 — scroll to see the custom scrollbar.

A scroll container with custom overlay scrollbars. Scrolling stays native (the viewport is a real overflow container); the scrollbars are painted from the scroll metrics.

<script>
import ScrollArea from "@invisible-ui/svelte/ScrollArea.svelte";
</script>

In Elements, the children become the scrolling content:

<ds-scroll-area max-height="10rem" label="Terms">
<p>…</p>
</ds-scroll-area>
PropTypeDefaultDescription
orientationScrollOrientation"vertical"Scrollable axes.
maxHeightstring"12rem"Max height of the viewport.
labelstring | undefinedundefinedAccessible name for the region.

The scrollable content is the default slot.

  • Native scrolling (keyboard works); custom scrollbars are decorative.
  • In right-to-left text the horizontal thumb starts at the right, follows the scroll position and drags the content the way it moves.
  • With a label the viewport becomes a landmark, so it appears in the landmark list: give each scroll area on a page its own name. Without a label it is a plain scroller and claims no place in that list.
<ScrollArea maxHeight="10rem" label="Terms"><p>…</p></ScrollArea>

In React, useScrollArea gives the same geometry and thumb drag to markup of your own:

<ScrollArea maxHeight="10rem" label="Terms">
<p>…</p>
</ScrollArea>

Themeable via --ds-scroll-area-*.