#
ScrollToTop
Import this floating caret component and it will appear once the user scrolls down. Clicking it scrolls the page to the top.
React / Next.js
ScrollToTop
The ScrollToTop component is a simple utility for scrolling to the top of the page with smooth animation.
Prop | Description | Value(s) |
---|---|---|
`color` | Sets the caret color. | `string | default: white` |
`bg` | Background color of the caret container. | `string | default: black` |
`size` | Icon size. | `number | default: 20` |
`threshold` | Pixel value after which the caret shows up. | `number | default: 200` |
`position` | Sets the position of the caret (bottom-right by default). | `object | { bottom: string, right: string }` |