Back to Top
Button that appears after scrolling, with a progress ring and smooth scroll to top.
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">
| Prop | Type | Default | Description |
|---|---|---|---|
| scrollTarget | React.RefObject<HTMLElement | null> | — | Scroll container to track; the window when omitted |
| threshold | number | 160 | Pixels scrolled before the button appears |
Install
$ npx shadcn@latest add https://chromotion.dev/r/back-to-top.json