1.0.1 • Published 3 years ago

react-tb v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

react-tb

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install --save react-tb

Usage Example

import { ReactTb } from 'react-tb'

class Example extends Component {
  render() {
    return <ReactTb
        columns={columns}
        data={data}
        noDataLabel='no data found!'
        isDraggable={true}
        onDragEnd={() => {}}
        columnKey={'id'}
      />
  }
}

Using Columns

columns are the array that defines the table columns to show the data like (firstname, lastname, ...etc).

columns example

const columns = [
  {
    name: "firstname", // column name will show in the header (accept html also)
    isHidden: false, // you can also hide or show the column by setting isHidden value
    body: (item) => {
      // you can use data with the specific column like item.whatever
      return <td></td> // you should always return jsx decorated by td tag
    }
  }
]

Table Props (required)

prop namedescription
columnthe table columns to define table
datathe table data (could come from the database)
columnKeythe unique key to identify each row
noDataLabellabel to show when no data
isDraggablemake the table's row draggable
onDragEndcallback function will be fired when drag is end ( will give you the new order)

License

MIT © AlsiddigAhmed

1.0.1

3 years ago

1.0.0

3 years ago