4.0.6 • Published 1 year ago

react-mixitup v4.0.6

Weekly downloads
27
License
MIT
Repository
github
Last release
1 year ago

react-mixitup

Animate the addition, removal and shuffling of elements in react.

GitHub Repo stars

Edit in CodeSandbox

Getting Started

Install react-mixitup

npm install --save react-mixitup

npm npm

See documentation

import { ReactMixitup } from 'react-mixitup';

function Example() {
  const [keys, setKeys] = React.useState([1,2,3]);

  return (
    <div style={{ height: 64 }}>
      <button onClick={() => {
        setKeys(keys[0] === 1 ? [3,2,1] : [1,2,3]);
      }}>
        Mixitup
      </button>
      <ReactMixitup
        keys={keys}
        renderCell={(key, style, ref) => (
          <div
            key={key}
            ref={ref}
            style={{
              // You must set the transition property here!
              transition: 'transform 300ms linear',
              ...style,
            }}
          >
            {key}
          </div>
        )}
        renderWrapper={(style, ref, cells) => {
          return (
            <div
              style={{
                transition: 'height 300ms ease',
                display: 'flex',
                ...style
              }}
              ref={ref}
            >
              {cells}
            </div>
          );
        }}
        dynamicDirection="horizontal"
        transitionDuration={300}
      />
    </div>
  )
}

License

MIT © ricsam

4.0.5

1 year ago

4.0.4

1 year ago

4.0.6

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

4.0.3

1 year ago

4.0.2

1 year ago

3.0.0

2 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago