Skip to content

ScrollTop ​

Back-to-top button past a threshold

A back-to-top button for long pages, shown once the reader has scrolled a way down (threshold). Short pages don't need one.

Basic
Scroll this page past 300px — a skewed ↑ button appears bottom-right (fixed to the window).
  • It scrolls smoothly, or jumps straight up under reduced motion.
  • target watches a scroll container instead of the window; label names the button.

Usage ​

ts
import { BlessScrollTop } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
thresholdnumber300px scrolled before the button shows
targetHTMLElement | null—scroll container; default window
labelstring"Back to top"
position"bottom-right" | "bottom-left""bottom-right"

Slots

NameScopeDescription
default—

Released under the MIT License. Character names and artwork belong to their owners.