Skip to component content

A quiet scrollbar without a layout gutter. The document or native scroll region still owns scrolling.

Document scrolling

Scroll inside the preview, or use Open standalone to try the same example as a full page. Its theme, direction and native-scrollbar controls stay inside the example.

<main id="main-content" class="container py-5">
  <h1 class="mb-3">Document scrollbar preview</h1>
  <p class="lead">A quiet page scrollbar without a layout gutter. The document still owns scrolling.</p>
  <p>Scroll to reveal the thumb. Stop scrolling and it fades away while you read. With a mouse, move to the trailing edge to reveal it again. Drag the thumb, click the track, or focus it with Tab and use Arrow keys, Page Up/Down, Home or End.</p>
  <p>Touch and wheel scrolling stay native. Reduced-motion preferences remove the fade transition. Forced-colors mode, printing and horizontal page overflow keep the native scrollbar instead. Disabling the enhancement restores it.</p>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 1</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 2</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 3</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 4</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 5</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 6</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 7</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 8</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 9</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 10</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 11</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 12</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 13</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 14</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 15</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
  <section class="py-4 border-top">
    <h2 class="h3 mb-3">Reading section 16</h2>
    <p>Read at your own pace. The scroll indicator stays out of the way until you need it. The page keeps its normal document structure, native scrolling, links and keyboard behavior.</p>
    <p>Try another theme or direction, resize the viewport, and compare the same content with the native scrollbar. The indicator follows the page position without moving the reading column.</p>
  </section>
</main>

Opt-in public module

import OverlayScrollbar from "@wpmoo/ui/overlay-scrollbar.js";

const owner = document.querySelector(".moo-ui");
const scrollbar = OverlayScrollbar.getOrCreateInstance(owner);

// scrollbar.refresh(); // after host geometry changes
// scrollbar.dispose(); // restore the native scrollbar

Place the example markup inside your existing .moo-ui theme owner and load the stylesheet before initialization. There is one instance per native scroll target, attached to one explicit theme owner. The default is the standards-mode document; pass scrollElement to use an existing native scrolling region, like the catalog's Page main. No replacement viewport is created. Showing and hiding the thumb never changes content width; enabling it initially removes the native gutter.

Touch and wheel scrolling stay native. Reduced-motion preferences remove the fade transition. Forced-colors mode, printing and horizontal page overflow keep the native scrollbar instead. Disabling the enhancement restores it.

Options and theme tokens

hideDelay defaults to 900 milliseconds; label supplies the localized accessible name. The default is “Page scroll position”. Importing the module does not initialize anything.

Bootstrap does not provide an overlay scrollbar. Its two geometry tokens are --moo-scrollbar-overlay-thumb-size (backed by $moo-scrollbar-overlay-thumb-size, inheriting the shared thin-scrollbar scale) and --moo-scrollbar-overlay-hit-size (backed by $moo-scrollbar-overlay-hit-size, a 24px interaction target). Color uses Bootstrap's secondary/emphasis text tokens, radius uses its pill token, edge spacing uses Bootstrap's smallest positive spacing step, and motion uses its reduced-motion-aware fade transition.

Settings

Theme
Choose how Moo UI looks on this device.
Sidebar
Choose how the sidebar sits on the page.
Theme Builder
Tune catalog tokens and chart colors for this browser.
Base color
Theme color
Chart color
Heading font
Body font
Radius
Direction
Choose the reading direction. RTL flips the layout live.
Reset

Restore the default appearance.