Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

thin-scrollbars-everywhere

npm bundle size

Thin, translucent scrollbars for the whole page, including every shadow root.

Example page

Useful when plain CSS cannot reach the scrollbars because they live inside shadow DOM:

  • Apps built on Lit or other web-component frameworks
  • Design systems shipped as custom elements (Shoelace, Material Web, FAST)
  • Micro-frontends where each team mounts into its own shadow root
  • Pages embedding third-party widgets that use closed shadow roots
  • Electron or WebView app shells styling every scrollbar at once

Usage

import { applyThinScrollbarsEverywhere } from "thin-scrollbars-everywhere";

applyThinScrollbarsEverywhere();

One call is enough. It keeps watching the page and styles new shadow roots as they appear. Call it as early as possible, before any shadow DOM is created. Closed shadow roots that already exist at call time cannot be reached.

This does not reach into iframe, object, or embed content. Those are whole separate pages with their own window, so each needs its own call.

How it works

A shared constructable stylesheet sets scrollbar-width: thin and a currentColor-based scrollbar-color on *. The sheet is adopted by the document and by every shadow root, found through a patched Element.prototype.attachShadow plus mutation observers that catch roots created before the call or attached inside other roots.

About

Thin, translucent scrollbars for the whole HTML page

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages