Giter VIP home page Giter VIP logo

react-expand-animated's Introduction

React Expand

react-expand-animated 1.0.2

Simple expandable wrapper component with height, opacity animation.

Demo

Edit 107wq1klr4

Install

npm i react-expand-animated

Usage

import React, { Component } from 'react';
import Expand from 'react-expand-animated';

class App extends Component {
  state = { open: false };

  toggle = () => {
    this.setState(prevState => ({ open: !prevState.open }));
  };

  render() {
    return (
      <Fragment>
        <button onClick={this.toggle}>Open</button>
        <Expand open={this.state.open}>
          <div style={{ width: '300px', height: '400px', color: 'red' }}>Hello</div>
        </Expand>
      </Fragment>
    );
  }
}

export default App;

Props

Props Type Required Default Description
children node true undefined The expanded or collapsed content
open bool false false When set to true expand the children component otherwise collapse it
duration number false 400 Animation duration in ms
easing string false 'ease-in-out' Css3 Animation's type
className string false '' Wrapper's className
tag string false 'div' Wrapper's tag
transitions arrayOf(string) false ['height', 'opacity'] Transition attributes
styles shape({ open: object, close: object }) false {} Additional inline-styles on open or close phase. For example: styles={open: { marginTop: 100 }, close: { marginTop: 0 }}

Development

Dev: npm run dev

Build: npm run build

Test: npm test

Test Coverage: npm run test:cov

react-expand-animated's People

Contributors

dependabot[bot] avatar domdomegg avatar sonybinhle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-expand-animated's Issues

Animation not playing

For some reason the animation doesn't play. Is this due to CSS?

`<Expand
open={context.state.collapse}
duration={1000}
easing={'ease-in-out'}
transitions={transitions}

`

Expanding dynamic generated content?

Does it also expand dynamic generated content?
That is: children items of a parent items are retrieved from the backend and should then be shown in smooth expandable way.

Update library dependencies

After installation i found out that there are 1445 vulnerabilities and most of them are high.
just perform npm update

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.