ScrollToTopButton

The ScrollToTopButton component displays a floating button that appears when you scroll down a page and allows users to quickly scroll back to the top.

Usage

Default

Scroll down the page to make the ScrollToTopButton appear. This demo uses a tall container to simulate a real scroll environment.


<div style={{ height: "200vh", padding: "2rem" }}>
  <p style={{ maxWidth: 600 }}>
    Scroll down the page to make the ScrollToTopButton appear. This demo
    uses a tall container to simulate a real scroll environment.
  </p>
  <ScrollToTop />
</div>

Props

Sortable data table
PropTypeDefaultDescription
rounding"none" | "small" | "medium" | "large"Configured DefaultCorner rounding for the button.
shadow"none" | "light" | "medium" | "strong" | "intense"Configured DefaultBox shadow style for the button.
offsetnumber300Scroll offset (in px) before the button appears.
classNamestring-Custom class name for the button.
data-testidstring"scroll"Test ID for querying the component in tests.