npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-simple-scroll-to-top

v1.0.1

Published

A very simple npm package for react,offering smooth, react-simple-scroll-to-top feature

Downloads

112

Readme

React-simple-scroll-to-top

Version

A very simple npm package for react,offering smooth, react-simple-scroll-to-top feature on any website. react-simple-scroll-to-top button component that scrolls to the top of a page when pressed The button is only visible once a certain height has been reached on the page.

NPM Downloads Stars

Installation

You can install react-simple-scroll-to-top using npm:

npm install react-simple-scroll-to-top

react-simple-scroll-to-top Styles

As react-simple-scroll-to-top expands, you can easily switch between different react-simple-scroll-to-top button styles. The current options are:

| react-simple-scroll-to-top Style | Import Code | Demo Button | | -------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------ | | SimpleScrollToTop | import { SimpleScrollToTop } from "react-simple-scroll-to-top"; | View Demo |

Basic Usage

To use the react-simple-scroll-to-top feature on any website from the library, follow these steps:

  1. Import the Component: In your main file (e.g., App.js or index.js), add the following imports:
import { SimpleScrollToTop } from "react-simple-scroll-to-top";
import "react-simple-scroll-to-top/dist/style.css";
  1. Add the react-simple-scroll-to-top Component: Place the desired react-simple-scroll-to-top component in your render method:
<SimpleScrollToTop />

Customization

You can customize the react-simple-scroll-to-top button's appearance using the following attributes:

| Attribute | Description | Default Value | | ------------------------ | ------------------------------------------------------------------------------------------------ | ----------------- | | size | Set the size of the react-simple-scroll-to-top button. | 30 | | color | Change the react-simple-scroll-to-top background color. | white | | CaretColor | Change the color of the caret (the up arrow) inside the button. | black | | border | Set the react-simple-scroll-to-top button border using CSS syntax (e.g., 1px solid black). | 1px solid black | | disableBounceAnimation | Set the value true or false to show or hide the bounce animation when the button appears. | true | | bottom | Set the number value to position the bottom part of the page where you want to see the button. | 20 | | right | Set the number value to position the right part of the page where you want to see the button. | 20 |

Example Usage

import React from "react";
import { SimpleScrollToTop } from "react-simple-scroll-to-top";
import "react-simple-scroll-to-top/dist/style.css"; // Import the necessary CSS

const App = () => {
  return (
    <div>
      {/* Custom Scroll to Top Button */}
      <SimpleScrollToTop
        size={30} // Control the size of the button
        color="red" // Control or change the background color of the button
        CaretColor="blue" // Control the caret (arrow) color
        border="2px solid green" // Set the border styling of the button
        disableBounceAnimation={false} // Set true or false to disable the bounce animation
        bottom={20} // Position the button from the bottom of the page
        right={20} // Position the button from the right side of the page
      />
      {/* Your other components */}
    </div>
  );
};

export default App;

Explanation of Customization Attributes:

  1. size={30}: Controls the overall size of the scroll-to-top button. The size is in pixels.
  2. color="red": Sets the background color of the button to red. You can use any valid CSS color (e.g., #ff6347, green, etc.).
  3. CaretColor="blue": Customizes the color of the caret (the up arrow) inside the button.
  4. opacity={0.8}: Sets the opacity of the button. The value should be between 0 (fully transparent) and 1 (fully opaque).
  5. border="2px solid green": Applies a green border with a 2px thickness around the button.
  6. disableBounceAnimation={false}: If false, the button will animate with a bounce effect. Set it to true to disable the bounce animation.
  7. bottom={20}: Sets the distance from the bottom of the page where the button will appear. You can adjust the number to move the button up or down.
  8. right={20}: Sets the distance from the right side of the page where the button will appear. Change this value to adjust the horizontal position.

Final Notes

  • Customization: You can easily adjust these props to fit your design needs. The button will automatically adapt to the size, color, opacity, and position you define.
  • Animation: The disableBounceAnimation prop controls whether the button should animate with a bounce effect when it appears.

Conclusion

With these simple customization options, you can integrate the react-simple-scroll-to-top feature into your website and make it fit your UI seamlessly.

Contributions

If you want to contribute to this project, fork the repository and clone it to your local machine. Commit your changes and push your changes to your forked repository. Finally, open a pull request with a detailed description of your changes to the dev branch.I highly appreciate any contributions.

Issues

If you are facing any problem, feel free to share here.

Changelog

### [1.0.1] - 2024-11-11

- Updated Readme

### [1.0.0] - 2024-11-10

- Initial release of `react-simple-scroll-to-top`.
- Added `SimpleScrollToTop` button style.
- Included basic usage examples in the documentation.

### [Unreleased]

- Features and improvements are being developed.

Contact Me

Gmail WhatsApp LinkedinFaceBookTelegram

Todo

  • ~~Add SimpleScrollToTop button style~~
  • Add Gradient style Scroll to top button.
  • Add Page Progress in button outline.
  • Add Wave Animation Scroll to top button.

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.

License