# react-to-top

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

Latest version **1.0.1** (published 2021-11-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-to-top
pnpm add react-to-top
yarn add react-to-top
bun add react-to-top
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-11-03 |
| First published | 2021-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Joaquin A. Moquette |
| Maintainers | moquette |
| Keywords | react, react component, to top, scroll up, progess on scroll |

## Links

- npm: https://www.npmjs.com/package/react-to-top
- Repository: https://github.com/moquette/react-to-top
- Homepage: https://github.com/moquette/react-to-top#readme
- Issues: https://github.com/moquette/react-to-top/issues
- npm.io page: https://npm.io/package/react-to-top

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-11-03
- 1.0.0 — 2021-10-31

## README

# React to Top (back to top)

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

[![NPM](https://img.shields.io/npm/v/react-to-top.svg)](https://www.npmjs.com/package/react-to-top) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)![npm bundle size](https://img.shields.io/bundlephobia/min/react-to-top)![GitHub](https://img.shields.io/github/license/moquette/react-to-top)

## Install

#### npm

```sh
npm i react-to-top
```

#### Yarn

```sh
yarn add react-to-top
```

---

### Examples

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

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

<br />

## Props

| Prop               |        Type         | Options  | Description                                                                          |         Default          |
| ------------------ | :-----------------: | -------- | ------------------------------------------------------------------------------------ | :----------------------: |
| `size`             |       number        | Optional | Set button width and height (in pixels)                                              |           `50`           |
| `offsetTop`        |       string        | Optional | Show button after number of pixels that document has scrolled vertically             |          `100`           |
| `bgColor`          |       string        | Optional | Button background color                                                              |    `rgb(0 0 0 / 75%)`    |
| `strokeWidth`      |       number        | Optional | Scroll progess bar width (in pixels)                                                 |           `4`            |
| `strokeFillColor`  |       string        | Optional | Scroll progess bar fill color                                                        |    `rgb(0 0 0 / 50%)`    |
| `strokeEmptyColor` |       string        | Optional | Scroll progess bar empty color                                                       | `rgb(200 200 200 / 85%)` |
| `symbol`           |       string        | Optional | Use any HTML [Symbols](https://unicode-table.com/en/2B99/) by simply _copy/paste_ it |           `🡩`            |
| `symbolSize`       |       number        | Optional | Symbol font size (in pixels)                                                         |           `20`           |
| `symbolColor`      |       string        | Optional | Symbol color                                                                         |          `#fff`          |
| `onScrolling`      |      function       | Optional | Callback `function` that is triggered while scrolling with `value` passed            |           `-`            |
| `onScrollEnd`      |      function       | Optional | Callback `function` that is triggered when scroll is ended                           |           `-`            |
| `className`        |       string        | Optional | CSS class name                                                                       |    `to-top-progress`     |
| `style`            | React.CSSProperties | Optional | CSS style                                                                            |           `-`            |

### License

MIT © [Joaquin A. Moquette](https://github.com/moquette/)

---
_Source: https://npm.io/package/react-to-top · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
