Skip to content

Scrollbar โ€‹

A scroll container with whereq.cc's thin, themeable scrollbar. It styles the native scrollbar (no scroll hijacking), so keyboard, wheel, touch and accessibility all keep working, with zero runtime scroll math.

๐Ÿงช Try every prop live in the Storybook.

Usage โ€‹

tsx
import { Scrollbar } from '@whereq/react'

;<Scrollbar style={{ maxHeight: 320 }}>
  <LongList />
</Scrollbar>

Auto-hide + a thicker rounded thumb:

tsx
<Scrollbar autoHide size={8} theme="auto" style={{ maxHeight: '70vh' }}>
  <Content />
</Scrollbar>

Horizontal, with custom colours:

tsx
<Scrollbar axis="horizontal" thumbColor="#17a2ae" thumbHoverColor="#0f7f89">
  <Row />
</Scrollbar>

Props โ€‹

<Scrollbar> extends React.HTMLAttributes<HTMLDivElement> โ€” className, style, onScroll, ref, and any other div prop pass through.

PropTypeDefaultDescription
axis'vertical' | 'horizontal' | 'both''vertical'Which axis may scroll.
sizenumber6Thumb/track thickness in px.
radiusnumbersize / 2Thumb corner radius in px.
theme'auto' | 'dark' | 'light' | 'neutral''auto'Colour preset โ€” see Theming.
thumbColorstringtheme valueOverride the thumb colour.
thumbHoverColorstringtheme valueOverride the thumb hover colour.
trackColorstringtransparentOverride the track colour.
autoHidebooleanfalseReveal the thumb only on hover / while scrolling.
autoHideDelaynumber1000ms the thumb stays after scrolling stops.
firefoxWidth'auto' | 'thin' | 'none''thin'Firefox scrollbar-width keyword.

Notes โ€‹

  • Auto-hide fully hides the thumb until hover / active scroll on Chromium & Safari. Firefox keeps its thin scrollbar visible (it can't style per-state pseudo-elements).
  • The component sets overflow for you based on axis; you only need to constrain the size (e.g. maxHeight).

Released under the MIT License.