overflow
scrollbar-color
Themes a scroll container's scrollbar via the standard scrollbar-color property, supported by Firefox and modern Chromium alike through plain CSS.
import { scrollbarColor } from "@sdxc/u/overflow";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.scrollbarColor() | css({ scrollbarColor: "auto" }) |
u.scrollbarColor("neutral") | css({ scrollbarColor: "var(--ui-neutral-border) transparent" }) |
u.scrollbarColor("brand.strong", "neutral") | css({ scrollbarColor: "var(--ui-brand-border-strong) var(--ui-neutral-bg-tint)" }) |
u.scrollbarColor("color.neutral.400", "color.neutral.100") | css({ scrollbarColor: "var(--ui-color-neutral-400) var(--ui-color-neutral-100)" }) |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.scrollbarColor()Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.scrollbarColor())Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.scrollbarColor())Customizing the theme
The custom properties this utility reads, which a theme redefines.
| Variable |
|---|
--ui-brand-border-strong |
--ui-color-neutral-100 |
--ui-color-neutral-400 |
--ui-neutral-bg-tint |
--ui-neutral-border |
Signature
u.scrollbarColor(thumb?: ColorValue | (string & {}), track?: ColorValue | (string & {}))