GuideCoreAdded in v15.7

Scrollbar

A thumb and nothing else, in the theme's colours. Opt in for the page or for one block.

What it is

No track, no arrows, no corner box. Scrolling, keyboard and touch stay native: only the paint changes.

With scrollbar

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

Classic scrollbar with a track

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

Opt in

Loading the theme emits no scrollbar rule. Include the mixin where you want one.

At the stylesheet root it covers the whole page. The rules sit at zero specificity, so any rule of yours wins.

// styles.scss
@use 'ngwr/theme' as wr;

@include wr.scrollbar;

Inside a rule it styles that element's own scrollbars only.

@use 'ngwr/theme' as wr;

.panel {
  max-height: 20rem;
  overflow: auto;

  @include wr.scrollbar;
}

wr-virtual-scroll and wr-marquee include it on their own viewport, so they look the same without the page-wide opt-in.

Tokens

Declared on :root by the theme.

TokenDefaultUse
--wr-scrollbar-size0.625remWidth of a vertical bar, height of a horizontal one
--wr-scrollbar-thumbcolor-mix(in srgb, var(--wr-color-on-surface) 20%, transparent)The thumb at rest
--wr-scrollbar-thumb-hovercolor-mix(in srgb, var(--wr-color-on-surface) 35%, transparent)The thumb under the pointer

Per scheme

A colour that differs between light and dark is one light-dark() value.

:root {
  --wr-scrollbar-thumb: light-dark(rgb(0 0 0 / 25%), rgb(255 255 255 / 30%));
  --wr-scrollbar-thumb-hover: light-dark(rgb(0 0 0 / 45%), rgb(255 255 255 / 50%));
}

Limits

WhereWhat happens
FirefoxDraws its own thin scrollbar in the thumb colour. No exact width.
macOS overlay scrollbarsShow only while scrolling, unless the system setting is "Always".
Forced colorsKeep the system scrollbar.

See also