Home

Awesome

React Masonry Mixin

npm version

Introduction:

A React.js Masonry mixin. (Also available as a component - you should use that instead!)

Live demo:

hearsay.me (web) hearsay.me (github)

Usage:

var React = require('react');
var MasonryMixin = require('react-masonry-mixin')(React);
 
var masonryOptions = {
    transitionDuration: 0
};
 
var SomeComponent = React.createClass({

    mixins: [MasonryMixin(React)('masonryContainer', masonryOptions)],
 
    render: function () {
        var childElements = this.props.elements.map(function(element){
           return (
                <div className="someclass">
                    {element.name}
                </div>
            );
        });
        
        return (
            <div ref="masonryContainer">
                {childElements}
            </div>
        );
    }
});

module.exports = SomeComponent;