MICLFoundationsScrollbar

Foundation

Scrollbar

This foundation gives every scrollbar on the page — the viewport's and those of scrollable components such as menus, sheets and panes — a slim, button-less appearance: an 8px rounded thumb in the theme's outline color role, set in a 2px transparent gutter.

  • 8px rounded thumb
  • Follows the theme
  • Firefox fallback

Scroll me.

The thumb uses the outline colour of the current theme.

There are no arrow buttons.

A 2px transparent gutter surrounds the thumb.

Switch the theme to watch it change.

Vertical

Every scroll container gets the slim scrollbar; no class is needed. Make a scrollable region focusable so keyboard users can scroll it.

Horizontal

Theming

Set --md-sys-scrollbar-thumb-color on <html> to change every thumb, or on a scroll container to change it locally.

Primary thumb

Native rendering

Compatibility

Chromium and Safari render the styled scrollbar through the ::-webkit-scrollbar pseudo-elements. Firefox, which lacks them, gets the closest standard equivalent: scrollbar-width: thin with the same thumb colour through scrollbar-color. Because Firefox resolves that colour on <html> and <body>, a local --md-sys-scrollbar-thumb-color does not reach it there; set scrollbar-color on the container instead. Browsers that support neither show their default scrollbars.