Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-scroll-to-top

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-scroll-to-top

A simple button component that scrolls to the top of the page when pressed\ The button is only visible when a certain height has been reached on the page\

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5K
increased by3.8%
Maintainers
1
Weekly downloads
 
Created
Source

react-scroll-to-top

A simple button component that scrolls to the top of the page when pressed
The button is only visible when a certain height has been reached on the page\

Live demo

Check out a live demo here

Installation

Run npm i react-scroll-to-top

Usage

Import the module and it's stylesheet
Include <ScrollToTop /> anywhere in your render/return function:

import ScrollToTop from "react-scroll-to-top";
import "react-scroll-to-top/lib/index.css"

function CoolPage() {
  return (
    <div>
      <ScrollToTop />
      <h1>Hello, world!</h1>
    </div>
  );
}

Props

PropTypeDescriptionDefault
topnumberThe height where the button gets visible20
colorstringThe arrow colorblack
bgColorstringButton background colorwhite
classNamestringCustom classname to add your own styling''
styleObjectObject to override styling
smoothbooleanWhether to use smooth scrolling*false

Smooth scrolling uses a newer window.scrollTo implementation.
Check out its support in browsers at MDN web docs.

Types

Written in TypeScript, no need for @types installation

Keywords

FAQs

Package last updated on 31 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc