[ @sdxc/u/overflow ]
noScrollbar
Hides the scrollbar across Chrome/Safari, legacy Edge, and Firefox, while the element stays scrollable by wheel, touch, keyboard, and script.
import { noScrollbar } from "@sdxc/u/overflow";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.noScrollbar() | css({ "&::-webkit-scrollbar": { display: "none" }, msOverflowStyle: "none", scrollbarWidth: "none" }) |
Examples
Basic example
Use noScrollbar() with scroll("x") to keep a row scrollable while hiding its scrollbar, as in a strip of filter chips. Scroll the row sideways with a trackpad or touch:
1
2
3
4
5
6
7
8
<div
mix={[
scroll("x"),
noScrollbar(),
hstack({ gap: 4 }),
is(96),
maxIs("100%"),
p(4),
...,
]}
>
<div mix={[shrink(), is(24), ...]}>1</div>
<div mix={[shrink(), is(24), ...]}>2</div>
<div mix={[shrink(), is(24), ...]}>3</div>
<div mix={[shrink(), is(24), ...]}>4</div>
<div mix={[shrink(), is(24), ...]}>5</div>
<div mix={[shrink(), is(24), ...]}>6</div>
<div mix={[shrink(), is(24), ...]}>7</div>
<div mix={[shrink(), is(24), ...]}>8</div>
</div>Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.noScrollbar())Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.noScrollbar())Signature
u.noScrollbar()