# use-scroll-display

> Slim React Hook for showing elements on scroll as they enter the viewport

Latest version **1.0.3** (published 2020-02-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install use-scroll-display
pnpm add use-scroll-display
yarn add use-scroll-display
bun add use-scroll-display
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-02-29 |
| First published | 2020-02-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | silind |
| Keywords | react, hooks |

## Links

- npm: https://www.npmjs.com/package/use-scroll-display
- Repository: https://github.com/Silind/use-scroll-display
- Homepage: https://github.com/Silind/use-scroll-display#readme
- Issues: https://github.com/Silind/use-scroll-display/issues
- npm.io page: https://npm.io/package/use-scroll-display

## 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.3 (latest) — 2020-02-29
- 1.0.2 — 2020-02-29
- 1.0.1 — 2020-02-29
- 1.0.0 — 2020-02-29

## README

# use-scroll-display
> Slim React Hook for showing elements on scroll as they enter the viewport

## Install

```console
npm i use-scroll-display
```
or
```console
yarn add use-scroll-display
```

## Usage

### Basic usage
```jsx
import React from 'react';
import useScrollDisplay from 'use-scroll-display';

const App = () => {
   const [displayRef, hasDisplayed] = useScrollDisplay();

   // true if element has been displayed, false otherwise
   console.log(hasDisplayed);

   return (
      <div ref={displayRef}>
         Appears when entering the viewport
      </div>
   );
}
```

### Custom offset

You can set the offset by passing a parameter.  
It defaults to `200`

```javascript
const [displayRef] = useScrollDisplay(350);
```

## Styles and animations
Currently, only one animation is supported.  
More will be added later.

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