Giter Site home page Giter Site logo

lucasbesen / react-kanban-dnd Goto Github PK

View Code? Open in Web Editor NEW
136.0 3.0 20.0 810 KB

:clipboard: Open source kanban board built with React

License: MIT License

JavaScript 9.38% TypeScript 90.62%
react kanban kanban-board drag-and-drop draggable hacktoberfest

react-kanban-dnd's Introduction

๐Ÿ”จ ย  Install and Usage

Live demo: click here

First, you need to install react-kanban-dnd on your project:

yarn add react-kanban-dnd

Then import it inside your project:

import ReactKanban from 'react-kanban-dnd';

export default class MyKanban extends React.Component {
  render() {
    return (
      <ReactKanban
        onDragEnd={this.onDragEnd}
        onDragStart={this.onDragStart}
        renderCard={this.renderCard}
        columns={columns}
        columnStyle={style.columnStyle}
        columnHeaderStyle={style.columnHeaderStyle}
        columnTitleStyle={style.columnTitleStyle}
        cardWrapperStyle={style.cardWrapperStyle}
      />
    );
  }
}

That's it. Now, kanban should appear on your project.

โš™๏ธ ย  Properties

Prop Description Required
onDragEnd Function that will be called when drag ends false
onDragStart Function that will be called when drag starts false
renderCard Function that will render your card. Receives a row as a parameter true
columns Array that will be used to render your kanban. Check the patterns here true
columnStyle Optional styling for the column false
columnHeaderStyle Optional styling for the column header false
columnTitleStyle Optional styling for the column title false
cardWrapperStyle Optional styling for the card wrapper false

๐Ÿ“Œ ย  Columns array pattern

Your column array should be something like this:

const columns = [
  {
    id: 'columnId',
    title: 'Column Title',
    rows: [
      {
        id: 'rowId',
        ...yourPropsHere, // Those props can be used on renderCard
      },
    ],
  },
];

Note: Both columnId and rowId should be a string.

๐Ÿ’ก ย  Example

import ReactKanban from 'react-kanban-dnd';

export default class MyKanban extends React.Component {
  renderCard = row => (
    <Wrapper>
      <TextWrapper>
        <Label>Name:</Label>
        <Value>{row.name}</Value>
      </TextWrapper>
      <TextWrapper>
        <Label>Age:</Label>
        <Value>{row.age}</Value>
      </TextWrapper>
    </Wrapper>
  );

  render() {
    const columns = [
      {
        id: 'column1',
        title: 'Column 1',
        rows: [
          {
            id: 'row1',
            name: 'User one',
            age: 21,
          },
        ],
      },
      {
        id: 'column2',
        title: 'Column 2',
        rows: [
          {
            id: 'row2',
            name: 'User two',
            age: 23,
          },
          {
            id: 'row3',
            name: 'User three',
            age: 30,
          },
        ],
      },
      {
        id: 'column3',
        title: 'Column 3',
        rows: [
          {
            id: 'row4',
            name: 'User four',
            age: 25,
          },
        ],
      },
    ];

    return (
      <ReactKanban
        renderCard={this.renderCard}
        columns={columns}
      />
    );
  }
}

๐Ÿค ย  Contributions

Start cloning the repository:

[email protected]:lucasbesen/react-kanban-dnd.git

Install dependencies:

yarn

Then run docz;

yarn docz:dev

Finally go to http://localhost:3000/docs-react-kanban

Every kind of contribution is welcome. You can ping me at Twitter as well.

๐Ÿ’ช๐Ÿป ย  Contributors


Lucas Besen

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก ๐Ÿ‘€

Caio Flores

๐Ÿ’ป ๐Ÿ“–

Isac

๐Ÿ’ป

Nfinger

๐Ÿ’ป

Austin Turner

๐Ÿ“–

Marcus Koh

๐Ÿ›

Gabriel F. Luchtenberg

๐Ÿ’ป

react-kanban-dnd's People

Contributors

caioflores avatar isacjunior avatar lucasbesen avatar paustint avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-kanban-dnd's Issues

Kanban for resource scheduling (time as a vertical access)

Any tips & level of difficulty getting this Kanban to be a scheduling board where:

  1. The vertical access is time for each task
  2. The cards have height proportional to the time the individual task takes
  3. The columns will be for resources (in our case repair stations)

Move to Lerna

I'm planning a roadmap and Lerna will be very useful.

We can begin with: #5

Can't resolve 'idx' in InnerList.js

Hi,
I am looking to try out this library. However, when i try to set it up, it shows me this warning.

./node_modules/react-kanban-dnd/lib/InnerList.js
Module not found: Can't resolve 'idx' in '/node_modules/react-kanban-dnd/lib'

Add examples with docz

We need some code examples showing react-kanban-dnd running. Docz will be a nice alternative to fix it.

How can I disable drag in drop?

Hi! I would like to lock drag in drop for some users in my project, is there a way to do it for all colunms and cards too?

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.