# react-transition-scroll

> Easily &amp; Beautifully create scroll transitions in react!

Latest version **1.1.2** (published 2024-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-transition-scroll
pnpm add react-transition-scroll
yarn add react-transition-scroll
bun add react-transition-scroll
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2024-03-27 |
| First published | 2022-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 260.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | alianza |
| Maintainers | phyrexalianza |

## Links

- npm: https://www.npmjs.com/package/react-transition-scroll
- Repository: https://github.com/alianza/react-transition-scroll
- Homepage: https://alianza.github.io/react-transition-scroll/
- Issues: https://github.com/alianza/react-transition-scroll/issues
- npm.io page: https://npm.io/package/react-transition-scroll

## Recent versions

- 1.1.2 (latest) — 2024-03-27
- 1.1.1 — 2024-03-26
- 1.1.0 — 2024-03-12
- 1.0.13 — 2024-02-08
- 1.0.12 — 2024-02-08
- 1.0.11 — 2024-02-08
- 1.0.10 — 2022-10-20
- 1.0.9 — 2022-10-20
- 1.0.8 — 2022-10-20
- 1.0.7 — 2022-10-20
- 1.0.6 — 2022-09-18
- 1.0.5 — 2022-09-18
- 1.0.4 — 2022-09-18
- 1.0.3 — 2022-09-18
- 1.0.2 — 2022-09-18
- … 2 more at https://npm.io/package/react-transition-scroll/versions

## README

# react-transition-scroll

> Easily &amp; Beautifully create scroll transitions in react!

[![NPM](https://img.shields.io/npm/v/react-transition-scroll.svg)](https://www.npmjs.com/package/react-transition-scroll) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Introduction

`react-transition-scroll` is a lightweight library to easily and
beautifully implement scroll animations/transition in react. It is built on top of the modern
IntersectionObserver API. It covers most use cases for scroll animations and transitions.

Check out examples [here](https://alianza.github.io/react-transition-scroll/)!

## Install
Npm:
```bash
npm install --save react-transition-scroll
```
Yarn:
```bash
yarn add --save react-transition-scroll
```

## Usage

```jsx
import React, { Component } from 'react'

import { TransitionScroll } from 'react-transition-scroll'
import 'react-transition-scroll/dist/index.css'

class Example extends Component {
  render() {
    return(
      <TransitionScroll options... >
        <YourComponentToAnimateOnScroll />
      </TransitionScroll>
    )
  }
}
```

## Options

| Name          | Type           | Default                                                    | Description                                                                                   |
|---------------|----------------|------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| `threshold`   | `number`       | `0`                                                        | Percentage of element that has to be in view to trigger transition (number between 0 and 100) |
| `reAnimate`   | `boolean`      | `false`                                                    | Whether to reanimate if element enters viewport again                                         |
| `baseStyle`   | `Style Object` | `{}`                                                       | Base styles to apply to transition element                                                    |
| `hiddenStyle` | `Style Object` | `{ opacity: 1, translate: '0 12px', filter: 'blur(4px)' }` | Styles to apply to transition element when hidden                                             |
| `showStyle`   | `Style Object` | `{ opacity: 0, translate: '0 0', filter: 'none' }`         | Styles to apply to transition element when hidden                                             |
| `className`   | `string`       | `''`                                                       | Classname to apply to the transition element                                                  |
| `as`          | `string`       | `'div'`                                                    | Wrapper HTML tag to render the transition element as                                          |

## Features

😮‍💨 Simple syntax  
👌 Honors `prefers-reduced-motion` media query  
🚀 Uses IntersectionObserver API (Blazingly fast)  
⛔ 0 dependencies!

## License

MIT © [alianza](https://github.com/alianza)

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