Components/Scroll
Universal Component

Scroll

`@better-scroll/scroll-bar` `TouchScroll`

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

Scroll

@better-scroll/scroll-bar TouchScroll

Behavior Notes

  • BetterScroll Mode
    • Supports bounce with a more consistent scrollbar appearance
    • Content/container changes auto refresh() (configurable via refreshOnContentChange)
  • Native Mode
    • Uses native browser scrolling
    • direction maps to overflow-x/y to keep structure consistent
    • macOS Safari uses native scrolling directly
    • Automatically falls back to native scrolling on macOS + Chromium 145+ (Chromium already supports it natively)
    • Set unified=true to force BetterScroll takeover across environments

Runtime Strategy (Priority)

  1. native=true: always use native scrolling (highest priority).
  2. unified=true: always let BetterScroll take over (consistent cross-environment behavior).
  3. Running on macOS Safari: use native scrolling directly.
  4. nativeAutoFallback=true and macOS + Chromium >= 145: auto switch to native scrolling.
  5. Otherwise: use BetterScroll.

Basic Usage

Scroll

Demo loads on client.

Direction and Scrollbar

Scroll (horizontal)

Demo loads on client.

Scroll (bounce + always show scrollbar)

Demo loads on client.

Scroll Chaining (Advanced)

By default inner scrolling does not propagate to the outer container (even at edges). Enable scrollChaining if you want scroll to bubble at the top/bottom.

⚠️ We do not recommend enabling scrollChaining by default. In nested scrolling layouts, it can make users unsure which layer is actually scrolling. Enable it only when parent-child scroll handoff is explicitly required.

Scroll (scroll chaining, advanced)

Demo loads on client.

Use Native Scrolling

If you do not need BetterScroll behavior, switch to native scrolling (keeps the same container structure).

Scroll (native)

Demo loads on client.

Pull-to-Refresh and Load More

  • Pull-to-refresh: enable pullDownRefresh, listen to @pulling-down, then call finishPullDown() when done.
  • Load more: enable pullUpLoad, listen to @pulling-up, then call finishPullUp() when done.
  • In native=true or auto-native fallback mode, events are degraded triggers; pullDownStop only works in BetterScroll mode.

Scroll (pull down + pull up)

Demo loads on client.

API

Props

PropTypeDefaultDescription
nativebooleanfalseDescription for native.
unifiedbooleanfalseForce BetterScroll takeover for consistent cross-environment behavior (overrides Safari/Chromium auto-native; native=true still wins).
nativeAutoFallbackbooleantrueControls auto-native fallback on macOS + Chromium 145+; does not affect the macOS Safari native-first rule.
noPaddingbooleanfalseDescription for noPadding.
scrollChainingbooleanfalseAllow parent scroll handoff at boundaries; not recommended by default, enable only when nested handoff is explicitly needed.
direction'vertical' | 'horizontal' | 'both''vertical'TextDirection
scrollbarbooleantrueDescription for scrollbar.
scrollbarFadebooleantrueDescription for scrollbarFade.
scrollbarInteractivebooleantrueDescription for scrollbarInteractive.
scrollbarAlwaysVisiblebooleanfalseDescription for scrollbarAlwaysVisible.
scrollbarMinSizenumber18Description for scrollbarMinSize.
probeType0 | 1 | 2 | 33BetterScroll probeType
bouncebooleantrueDescription for bounce.
clickbooleantrueDescription for click.
wheelbooleantrueDescription for wheel.
refreshOnContentChangebooleantrueDescription for refreshOnContentChange.
pullDownRefreshboolean | Record<string, unknown>falseText(BetterScroll Text;native TextTrigger)
pullDownThresholdnumber70Description for pullDownThreshold.
pullDownStopnumber56Description for pullDownStop.
pullUpLoadboolean | Record<string, unknown>falseTextLoadingText(BetterScroll Text;native TextTrigger)
pullUpThresholdnumber0Description for pullUpThreshold.
optionsRecord<string, unknown>{}Description for options.

Events

EventParamsDescription
scroll{ scrollTop: number; scrollLeft: number }Description for scroll.
pulling-down-Description for pulling-down.
pulling-up-Description for pulling-up.
Was this helpful?