Direction-aware scroll progress button that jumps to the top or bottom on click.
npx shadcn@latest add https://refinery.abhii.me/r/move-to-top-button.json| Name | Type | Description |
|---|---|---|
| size | number | Size in pixels for the button's width and height. |
| className | string | Additional CSS classes to apply to the button for custom styling. |
Motion's useScroll hook is used to track both scroll position and page progress. The SVG circle's circumference becomes the progress ring, filling as you move down the page. The button switches between up and down modes based on scroll direction, so you can use it as a quick jump to the top or bottom with smooth scroll behavior.