Pluggable components to add a kanban board to your application
Pluggable components to add a kanban board to your application
Pluggable components to add a Trello (like) kanban board to your application
This library is not affiliated, associated, authorized, endorsed by or in any way officially connected to Trello, Inc.
Trellois a registered trademark of Atlassian, Inc.
Install using npm or yarn
$ npm install --save react-trelloor
$ yarn add react-trelloThe Board component takes a prop called data that contains all the details related to rendering the board. A sample data json is given here to illustrate the contract:
const data = {
lanes: [
{
id: 'lane1',
title: 'Planned Tasks',
label: '2/2',
cards: [
{id: 'Card1', title: 'Write Blog', description: 'Can AI make memes', label: '30 mins', draggable: false},
{id: 'Card2', title: 'Pay Rent', description: 'Transfer via NEFT', label: '5 mins', metadata: {sha: 'be312a1'}}
]
},
{
id: 'lane2',
title: 'Completed',
label: '0/0',
cards: []
}
]
}draggable property of Card object is true by default.
The data is passed to the board component and that's it.
import React from 'react'
import Board from 'react-trello'
export default class App extends React.Component {
render() {
return <Board data={data} />
}
}Refer to storybook for detailed examples: https://rcdexta.github.io/react-trello/
Also refer to the sample project that uses react-trello as illustration: https://github.com/rcdexta/react-trello-example
$ yarn add rcdexta/react-trelloand
import Board from 'react-trello/src'Breaking changes. Since version 2.2 these properties are removed: addLaneTitle, addCardLink, customLaneHeader, newCardTemplate, newLaneTemplate,
and customCardLayout with children element.
Follow upgrade instructions to make easy migration.
This is the container component that encapsulates the lanes and cards
| Name | Type | Description |
|---|---|---|
| data | object | Actual board data in the form of json |
| Name | Type | Description |
|---|---|---|
| draggable | boolean | Makes all cards and lanes draggable. Default: false |
| laneDraggable | boolean | Set to false to disable lane dragging. Default: true |
| cardDraggable | boolean | Set to false to disable card dragging. Default: true |
| collapsibleLanes | boolean | Make the lanes with cards collapsible. Default: false |
| editable | boolean | Makes the entire board editable. Allow cards to be added or deleted Default: false |
| canAddLanes | boolean | Allows new lanes to be added to the board. Default: false |
| hideCardDeleteIcon | boolean | Disable showing the delete icon to the top right corner of the card (when board is editable) |
| editLaneTitle | boolean | Allow inline lane title edit Default: false |
| Name | Type | Description |
|---|---|---|
| handleDragStart | function | Callback function triggered when card drag is started: handleDragStart(cardId, laneId) |
| handleDragEnd | function | Callback function triggered when card drag ends, return false if you want to cancel drop: handleDragEnd(cardId, sourceLaneId, targetLaneId, position, cardDetails) |
| handleLaneDragStart | function | Callback function triggered when lane drag is started: handleLaneDragStart(laneId) |
| handleLaneDragEnd | function | Callback function triggered when lane drag ends: handleLaneDragEnd(removedIndex, addedIndex, payload) |
| onDataChange | function | Called everytime the data changes due to user interaction or event bus: onDataChange(newData) |
| onCardClick | function | Called when a card is clicked: onCardClick(cardId, metadata, laneId) |
| onCardAdd | function | Called when a new card is added: onCardAdd(card, laneId) |
| onBeforeCardDelete | function | Called before delete a card, please call the callback() if confirm to delete a card: onConfirmCardDelete(callback) |
| onCardDelete | function | Called when a card is deleted: onCardDelete(cardId, laneId) |
| onCardMoveAcrossLanes | function | Called when a card is moved across lanes onCardMoveAcrossLanes(fromLaneId, toLaneId, cardId, index) |
| onLaneAdd | function | Called when a new lane is added: onLaneAdd(params) |
| onLaneDelete | function | Called when a lane is deleted onLaneDelete(laneId) |
| onLaneUpdate | function | Called when a lane attributes are updated onLaneUpdate(laneId, data) |
| onLaneClick | function | Called when a lane is clicked onLaneClick(laneId). Card clicks are not propagated to lane click event |
| onLaneScroll | function | Called when a lane is scrolled to the end: onLaneScroll(requestedPage, laneId) |
| Name | Type | Description |
|---|---|---|
| eventBusHandle | function | This is a special function that providers a publishHook to pass new events to the board. See details in Publish Events section |
| laneSortFunction | function | Used to specify the logic to sort cards on a lane: laneSortFunction(card1, card2) |
| Name | Type | Description |
|---|---|---|
| lang | string | Language of compiled texts ("en", "ru", "pt-br"). Default is "en" |
| t | function | Translation function. You can specify either one key as a String. Look into ./src/locales for keys list |
| Name | Type | Description |
|---|---|---|
| style | object | Pass CSS style props to board container |
| cardStyle | object | CSS style for every cards |
| laneStyle | object | CSS style for every lanes |
| tagStyle | object | If cards have tags, use this prop to modify their style |
| cardDragClass | string | CSS class to be applied to Card when being dragged |
| cardDropClass | string | CSS class to be applied to Card when being dropped |
| laneDragClass | string | CSS class to be applied to Lane when being dragged |
| laneDropClass | string | CSS class to be applied to Lane when being dropped |
| components | object | Map of customised components. List of available. |
| Name | Type | Description |
|---|---|---|
| id | string | ID of lane |
| style | object | Pass CSS style props to lane container |
| labelStyle | object | Pass CSS style props of label |
| cardStyle | object | Pass CSS style props for cards in this lane |
| disallowAddingCard | boolean | Disallow adding card button in this lane (default: false) |
Refer to stories folder for examples on many more options for customization.
It is possible to make the entire board editable by setting the editable prop to true. This switch prop will ena
No open issues yet, or sync has not completed.