https://github.com/mdbootstrap/react-back-to-top
Scroll Back To Top link built with Bootstrap 5. Create a button that appears when you start scrolling and on click smooth scrolls you to the top of the page. https://mdbootstrap.com/docs/react/extended/back-to-top/
https://github.com/mdbootstrap/react-back-to-top
back bootstrap bootstrap-template bootstrap-theme bootstrap5 css html js react scroll top
Last synced: about 2 months ago
JSON representation
Scroll Back To Top link built with Bootstrap 5. Create a button that appears when you start scrolling and on click smooth scrolls you to the top of the page. https://mdbootstrap.com/docs/react/extended/back-to-top/
- Host: GitHub
- URL: https://github.com/mdbootstrap/react-back-to-top
- Owner: mdbootstrap
- License: other
- Created: 2022-08-04T11:21:21.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-04T12:21:39.000Z (almost 3 years ago)
- Last Synced: 2025-02-27T22:12:31.512Z (3 months ago)
- Topics: back, bootstrap, bootstrap-template, bootstrap-theme, bootstrap5, css, html, js, react, scroll, top
- Language: JavaScript
- Homepage:
- Size: 266 KB
- Stars: 1
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License.pdf
Awesome Lists containing this project
README

# MDB React 5
Scroll Back To Top link built with Bootstrap 5. Create a button that appears when you start scrolling and on click smooth scrolls you to the top of the page.
Check out [React Scroll Back To Top Documentation](https://mdbootstrap.com/docs/b5/react/extended/back-to-top/) for detailed instructions & even more examples.
## Basic example (Click on the image to see a live demo)
[](https://mdbootstrap.com/docs/react/extended/back-to-top#section-basic-example)
```js
import React from 'react';
import { MDBBtn, MDBContainer, MDBIcon } from 'mdb-react-ui-kit';function App() {
let mybutton;window.onscroll = function () {
mybutton = document.getElementById("btn-back-to-top");
scrollFunction(mybutton);
};function scrollFunction(mybutton) {
if (
document.body.scrollTop > 20 ||
document.documentElement.scrollTop > 20
) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}function backToTop() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}return (
Start scrolling the page and a strong
"Back to top" button will appear in the
bottom right corner of the screen.
Click this button and you will be taken to the top of the page.
);
}export default App;
```
## How to use?1. Download MDB 5 - free REACT UI KIT
2. Choose your favourite customized component and click on the image
3. Copy & paste the code into your MDB project
[▶️ Subscribe to YouTube channel for web development tutorials & resources](https://www.youtube.com/MDBootstrap?sub_confirmation=1)
## More extended React documentation
- React Bootstrap Code
- React Bootstrap Gallery
- React Bootstrap Hamburger Menu
- React Bootstrap Jumbotron
- React Bootstrap Maps
- React Bootstrap Mega Menu
- React Bootstrap Media object
- React Bootstrap Multiselect
- React Bootstrap Masonry
- React Bootstrap Contact form
- React Bootstrap Gradients
- React Bootstrap Pagination
- React Bootstrap Panels
- React Bootstrap Social Media icons & buttons
- React Bootstrap Search
- React Bootstrap Table sort
- React Bootstrap Table responsive
- React Bootstrap Table scroll
- React Bootstrap Table search
- React Bootstrap Textarea
- React Bootstrap Sidebar
- React Bootstrap Profiles
- React Bootstrap Nested Dropdown
- React Bootstrap Address Form
- React Bootstrap Address Form