https://github.com/nzambello/react-scrolltop
React component that adds a 'scroll to top' button.
https://github.com/nzambello/react-scrolltop
javascript library react reactjs scroll scroll-to-top
Last synced: about 2 months ago
JSON representation
React component that adds a 'scroll to top' button.
- Host: GitHub
- URL: https://github.com/nzambello/react-scrolltop
- Owner: nzambello
- License: mit
- Created: 2019-10-03T13:31:23.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T22:05:25.000Z (over 3 years ago)
- Last Synced: 2024-10-16T02:05:14.665Z (over 1 year ago)
- Topics: javascript, library, react, reactjs, scroll, scroll-to-top
- Language: JavaScript
- Size: 462 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-scrolltop
[](https://github.com/nzambello/react-scrolltop/blob/master/LICENSE)
[](https://www.npmjs.com/package/@nzambello/react-scrolltop)
[](https://www.npmjs.com/package/@nzambello/react-scrolltop)
React component that adds a 'scroll to top' button fixed on the bottom of the page and shown if not scrolled up.
You can try it out in a [demo on Codesandbox](https://codesandbox.io/embed/ecstatic-night-9il6f).
## Installation
Install the package with either yarn or npm.
With yarn:
```sh
yarn add @nzambello/react-scrolltop
```
With npm:
```sh
npm install --save @nzambello/react-scrolltop
```
## Usage
```js
import React from 'react'
import ReactDOM from 'react-dom'
import ScrollTop from '@nzambello/react-scrolltop'
const App = () => (
...
)
ReactDOM.render(, document.getElementById('root'))
```