1.0.1 • Published 2 years ago

react-to-top v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React to Top (back to top)

A minimal lightweight react component for adding a nice scroll up (back to top) with onScroll progress.

NPM JavaScript Style Guidenpm bundle sizeGitHub

Install

npm

npm i react-to-top

Yarn

yarn add react-to-top

Examples

import React from 'react'
import { ScrollToTop } from 'react-to-top'

const MyComponent = () => {
  return (
    <div className='App'>
      <ScrollToTop {/* Props */} />
    </div>
  )
}

Props

PropTypeOptionsDescriptionDefault
sizenumberOptionalSet button width and height (in pixels)50
offsetTopstringOptionalShow button after number of pixels that document has scrolled vertically100
bgColorstringOptionalButton background colorrgb(0 0 0 / 75%)
strokeWidthnumberOptionalScroll progess bar width (in pixels)4
strokeFillColorstringOptionalScroll progess bar fill colorrgb(0 0 0 / 50%)
strokeEmptyColorstringOptionalScroll progess bar empty colorrgb(200 200 200 / 85%)
symbolstringOptionalUse any HTML Symbols by simply copy/paste it🡩
symbolSizenumberOptionalSymbol font size (in pixels)20
symbolColorstringOptionalSymbol color#fff
onScrollingfunctionOptionalCallback function that is triggered while scrolling with value passed-
onScrollEndfunctionOptionalCallback function that is triggered when scroll is ended-
classNamestringOptionalCSS class nameto-top-progress
styleReact.CSSPropertiesOptionalCSS style-

License

MIT © Joaquin A. Moquette