# react-hero-animation

> A small react library for hero animations.

Latest version **0.2.2** (published 2017-01-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-hero-animation
pnpm add react-hero-animation
yarn add react-hero-animation
bun add react-hero-animation
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2017-01-29 |
| First published | 2017-01-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Wertarbyte |
| Maintainers | wertarbyte |
| Keywords | react, material, hero, animation, transition |

## Links

- npm: https://www.npmjs.com/package/react-hero-animation
- Repository: https://github.com/TeamWertarbyte/react-hero-animation
- Homepage: https://github.com/TeamWertarbyte/react-hero-animation#readme
- Issues: https://github.com/TeamWertarbyte/react-hero-animation/issues
- npm.io page: https://npm.io/package/react-hero-animation

## Dependencies (1)

- [react-addons-transition-group](https://npm.io/package/react-addons-transition-group.md) ^15.4.2

## 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

- 0.2.2 (latest) — 2017-01-29
- 0.2.1 — 2017-01-29
- 0.2.0 — 2017-01-22
- 0.1.1 — 2017-01-21
- 0.1.0 — 2017-01-21

## README

# react-hero-animation
With this library, you can easily create Hero animations in your React apps. A demo is available [here][gh-pages].

## Usage
The `HeroAnimationProvider` needs to wrap all components. It tracks the registered heroes and which one to animate.

Also, every animatable element (the heroes) need to be wrapped with a `Hero` component.

```jsx
import { HeroAnimationProvider, Hero } from 'react-hero-animation'

<HeroAnimationProvider>
  <Hero id='hero-1' show={true}>
    <YourChildComponent />
  </Hero>
  <Hero id='hero-1' show={false}>
    <YourChildComponent />    
  </Hero>
</HeroAnimationProvider>
```

## `Hero` properties
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| children* | `element` | | One child element, must be either a dom element or a `React.Component` instance (it gets a `ref`, so pure functional components are not supported). |
| id* | `string` | | A unique ID of this hero. Every hero with the same ID is treated as one animatable element and only one of it can be visible at once. |
| resize | `bool` | `false` | If true, the wrapped component will be resized (using `width` and `height`) instead of scaled. |
| show | `bool` | `false` | Displays the wrapped component, using a hero animation. Only one `Hero` can be displayed at a time. |

## License
The files included in this repository are licensed under the MIT license.

## Related projects
There is another project, [Pajn/react-hero-transition][react-hero-transition], that provides almost the same functionality (except for `resize`) and might be more flexible. It was published four days before this library, we just found it when we were about to publish this one.

[gh-pages]: https://teamwertarbyte.github.io/react-hero-animation/
[react-hero-transition]: https://github.com/Pajn/react-hero-transition

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