All Projects → jrowny → React Absolute Grid

jrowny / React Absolute Grid

Licence: mit
An absolutely positioned, animated, filterable, sortable, drag and droppable, ES6 grid for React.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Absolute Grid

React Key Handler
React component to handle keyboard events 🔑
Stars: ✭ 386 (-57.58%)
Mutual labels:  react-components, react-component, reactjs-components
light-ui
A lightly React UI library
Stars: ✭ 38 (-95.82%)
Mutual labels:  react-component, react-components
react-native-value-picker
Cross-Platform iOS(ish) style picker for react native.
Stars: ✭ 18 (-98.02%)
Mutual labels:  react-component, react-components
Eo Locale
🌏Internationalize js apps 👔Elegant lightweight library based on Internationalization API
Stars: ✭ 290 (-68.13%)
Mutual labels:  react-components, reactjs-components
animation-wrapper-view
Declarative animations with imperative controls for RN/RNW.
Stars: ✭ 53 (-94.18%)
Mutual labels:  react-component, react-components
delete-react-zombies
CLI to search and delete unimported 🧟components in your react ⚛️ files
Stars: ✭ 70 (-92.31%)
Mutual labels:  react-component, react-components
Flawwwless Ui
Flawwwless ui library for React.js.
Stars: ✭ 265 (-70.88%)
Mutual labels:  react-components, react-component
tiny-ui
⚛️ A friendly UI component set for React.js
Stars: ✭ 202 (-77.8%)
Mutual labels:  react-component, react-components
React Js Pagination
Stars: ✭ 308 (-66.15%)
Mutual labels:  react-components, react-component
React Scope
Visualize your React components as you interact with your application.
Stars: ✭ 316 (-65.27%)
Mutual labels:  react-components, reactjs-components
Base
React-UI-Kit - frontend library with ReactJS components
Stars: ✭ 18 (-98.02%)
Mutual labels:  react-components, react-component
React Awesome Query Builder
User-friendly query builder for React
Stars: ✭ 682 (-25.05%)
Mutual labels:  react-components, react-component
react-crud-icons
57 SVG icons for CRUD applications, packaged as a React component with light & dark themes and tooltip.
Stars: ✭ 19 (-97.91%)
Mutual labels:  react-component, react-components
react-circle-flags
🚀 A React component with a collection of 300+ minimal circular SVG country flags. Wrapper of HatScripts/circle-flags
Stars: ✭ 29 (-96.81%)
Mutual labels:  react-component, react-components
fluent-windows
🌈 React components that inspired by Microsoft's Fluent Design System.
Stars: ✭ 122 (-86.59%)
Mutual labels:  react-component, react-components
reactjs-portfolio
Welcome to my portfolio react.js repository page.
Stars: ✭ 109 (-88.02%)
Mutual labels:  react-component, react-components
Registration-and-Login-using-MERN-stack
Simple Registration and Login component with MERN stack
Stars: ✭ 210 (-76.92%)
Mutual labels:  react-component, react-components
git-issue-react-electronjs
⚙️. ⚛️. A desktop application created with Electronjs and Reactjs to be cross-platform to manage and track GitHub issues.
Stars: ✭ 21 (-97.69%)
Mutual labels:  react-component, react-components
Formsy React Components
Bootstrap components for a formsy-react form.
Stars: ✭ 290 (-68.13%)
Mutual labels:  react-components, react-component
Recipes App React Native
Recipes App in React Native
Stars: ✭ 386 (-57.58%)
Mutual labels:  react-components, react-component

React Absolute Grid

Unmaintained:

This library is unmaintained and has not been tested to work with React 16+. We're looking for maintainers. If you're interested, file an issue.

Description:

An absolute layout grid with animations, filtering, zooming, and drag and drop support. Use your own component as the grid item. See the Demo.

Usage:

Install with npm install react-absolute-grid

import React from 'react';
import createAbsoluteGrid from './lib/AbsoluteGrid.jsx';

// This is the component that will display your data
import YourDisplayComponent from 'your-display-component';

 var sampleItems = [
  {key: 1, name: 'Test', sort: 0, filtered: 0},
  {key: 2, name: 'Test 1', sort: 1, filtered: 0},
];

// Pass your display component to create a new grid
const AbsoluteGrid = createAbsoluteGrid(YourDisplayComponent, {someProp: 'my component needs this'});
React.render(<AbsoluteGrid items={sampleItems} />, document.getElementById('Container'));

CreateAbsoluteGrid

createAbsoluteGrid(DisplayComponent, displayProps = {}, forceImpure = false)
  • DisplayComponent: is a react component to display in your grid
  • displayProps: optional : are properties you want passed down to the DisplayComponent such as event handlers.
  • forceImpure: optional : not recommended Will make this function as an impure component, meaning it always renders.

Options (Properties)

Property Default Description
items [] The array of items in the grid
keyProp 'key' The property to be used as a key
filterProp 'filtered' The property to be used for filtering, if the filtered value is true, the item won't be displayed. It's important to not remove items from the array because that will cause React to remove the DOM, for performance we would rather hide it then remove it.
sortProp 'sort' The property to sort on
itemWidth 128 The width of an item
itemHeight 128 The height of an item
verticalMargin -1 How much space between rows, -1 means the same as columns margin which is dynamically calculated based on width
responsive false If the container has a dynamic width, set this to true to update when the browser resizes
dragEnabled false Enables drag and drop listeners, onMove will be called with the keys involved in a drag and drop
animation 'transform 300ms ease' The CSS animation to use on elements. Pass a blank string or false for no animation.
zoom 1 Zooms the contents of the grid, 1 = 100%
onMove fn(from, to) This function is called when an item is dragged over another item. It is your responsibility to update the sort of all items when this happens.
onDragStart fn(e) This function is called when an item starts dragging, this is NOT required.
onDragMove fn(e) This function is called when as an item is being moved, this is NOT required.
onDragEnd fn(e) This function is called when an item has finished its drag, this is NOT required.

Your Component

Your component will receive item, index and itemsLength as props, as well as anything you pass into the createAbsoluteGrid function. Here's the simplest possible example:

import React from 'react';

export default function SampleDisplay(props) {
    // Supposing your item shape is something like {name: 'foo'}
    const { item, index, itemsLength } = props;
    return <div>Item {index} of {itemsLength}: {item.name}</div>;
}

What Makes AbsoluteGrid Unique?

The idea behind AbsoluteGrid is high performance. This is achieved by using Translate3d to position each item in the layout. Items are never removed from the DOM, instead they are hidden. For best performance you should avoid re-arranging or removing items which you pass into AbsoluteGrid, instead you can use the filtered and sort properties to hide or sort an item. Those properties are customizable using the keyProp and filterProp properties. In addition, all data passed must be immutable so that we don't waste any renders.

Your Display Component props

Each Component is passed the following props, as well as anything passed into the second parameter of createAbsoluteGrid

Property Description
item The data associated with the GridItem
index The index of the item data in the items array
itemsLength The total length of the items array
...displayProps props passed into createAbsoluteGrid

ToDo:

  • Tests
  • Improve Drag & Drop browser support and reliability

Browser Compatibility

This component should work in all browsers that support CSS3 3D Transforms. If you need IE9 support you can modify it to use transform rather than transform3d. Pull requests welcome!

Drag and Drop only works on IE11+ due to lack of pointer events, although there is a workaround coming soon.

Migrating from 2.x

Instead of passing displayObject to the AbsoluteGrid component, pass the component directly into the composer function, createAbsoluteGrid which returns an AbsoluteGrid component. That's it!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].