Atelier UI

Search components…

Search components…

Back to Top

Button that appears after scrolling, with a progress ring and smooth scroll to top.

Edit in sandbox

Copy a prompt for your AI coding tool with the source, dependencies and usage

Props

BackToTopProps

Also accepts all props of Omit<React.ComponentProps<"button">, "children" | "onClick">

PropTypeDefaultDescription
scrollTargetReact.RefObject<HTMLElement | null>—Scroll container to track; the window when omitted
thresholdnumber160Pixels scrolled before the button appears

Install

$ npx shadcn@latest add https://chromotion.dev/r/back-to-top.json

More like this