An open API service indexing awesome lists of open source software.

https://github.com/itsjonq/playful

▶️ Playful: A simple transition library for React (and routers!)
https://github.com/itsjonq/playful

Last synced: 7 months ago
JSON representation

▶️ Playful: A simple transition library for React (and routers!)

Awesome Lists containing this project

README

          

# ▶️ Playful

> A simple transition library for React (and routers!)

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Effects](#effects)
- [Direction](#direction)
- [Example](#example)

## Installation

```
npm install --save playful
```

## Usage

```jsx
import {withTransition} from 'playful'

// Create your components as you normally would
const MyComponent = () =>

My Content

// Define the effect you'd like your component to animate with when it is
// mounted and unmounted. Technically, you don't need to do this.
// The library has some nice smart defaults.
const playOptions = {
effect: 'fadeAndPop',
duration: 600,
direction: 'up',
}

// Create the enhanced component using withTransition along with your
// options and component.
const PlayfulComponent = withTransition(playOptions)(MyComponent)

// Render it out! ✨
const App = () => {
return (




)
}
```

## Effects

Playful supports the following transition effects:

- fade
- fadeAndPop
- fadeAndSlide
- pop
- scale
- slide
- swipe
- zoom

## Direction

The following directions can be applied to directonal moving effects:

- `up`
- `down`
- `left`
- `right`

The default direction is `right`.

## Example

[Check out the Storybook example!](https://react-playful.netlify.com/iframe.html?selectedKind=Playful&selectedStory=Example&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel)