# react-bootstrap-table-pro

> Awesome table component to work efficiently with dynamic data.

Latest version **0.0.5** (published 2020-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-bootstrap-table-pro
pnpm add react-bootstrap-table-pro
yarn add react-bootstrap-table-pro
bun add react-bootstrap-table-pro
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2020-04-23 |
| First published | 2017-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 60.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Carlos David Asmadt |
| Maintainers | cavillo |

## Links

- npm: https://www.npmjs.com/package/react-bootstrap-table-pro
- Repository: https://github.com/cavillo/react-bootstrap-table-pro
- Homepage: https://github.com/cavillo/react-bootstrap-table-pro#readme
- Issues: https://github.com/cavillo/react-bootstrap-table-pro/issues
- npm.io page: https://npm.io/package/react-bootstrap-table-pro

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^15.5.4
- [webpack](https://npm.io/package/webpack.md) ^2.6.1
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0

## Recent versions

- 0.0.5 (latest) — 2020-04-23
- 0.0.4 — 2017-12-06
- 0.0.3 — 2017-12-06
- 0.0.2 — 2017-12-06
- 0.0.1 — 2017-12-05

## README

# TablePro
This is a React component for working with data tables! It allows to search, paginate and customize the loading of dynamic data in a table. It uses Bootstrap (v4) style for good looks ;)

## Installation
`npm i react-bootstrap-table-pro --save`

## Usage

Test.js:
``` js
import React, { Component } from 'react';

import TablePro from 'react-bootstrap-table-pro';

class Test extends Component {
  constructor(props) {
    super(props);
    const data = {
      'id-1' : {
        'name' : 'Foo Bar',
        'email' : 'foo@bar.com',
        'status' : 'NEW',
        'created_at' : '2017-12-01T00:06:21.235Z',
        'updated_at' : '2017-12-01T00:06:21.236Z'
      },
      'id-2' : {
        'name' : 'Baz Bar',
        'email' : 'baz@bar.com',
        'status' : 'NEW',
        'created_at' : '2017-12-01T00:06:21.235Z',
        'updated_at' : '2017-12-01T00:06:21.236Z'
      }
    };

    this.state = {
      data,
    };
  }
  render(){
    return (
      <div className='row'>
        <div className='col-md-12'>
          <div className='table-responsive'>
            <h2>New clients</h2>
            <TablePro
              pageSize={10} // Number of rows per page.
              keys={ // Columns defined in the table.
                {
                  name: { // key property for each element in data set.
                    label: 'Name', // name to print in table header.
                    searchAs:(k,a)=>{ // function used to get searchable value. k: row ID, a: value. -> (a === this.state.data[k].name).
                      return a;
                    },
                    renderAs:(k,a)=>{ // function used to get printable value. k: row ID, a: value. -> (a === this.state.data[k].name).
                      return(
                        <a href={`/clients/${k}`}>{a}</a>
                      );
                    }
                  },
                  email: {
                    label: 'Email',
                  },
                  created_at: {
                    label: 'Created',
                    renderAs:(k,a)=>(new Date(a)).toDateString(),
                    searchAs:(k,a)=>{
                      return a;
                    },
                  },
                  status: {
                    label: 'Status',
                    renderAs:(k,a)=>{
                      return(
                        <div className="float-right">
                          <strong>{a}</strong>
                        </div>
                      );
                    }
                  },
                }
              }
              data={this.state.data}/> // Data source in Object format. (See this.state.data defined in constructor).
          </div>
        </div>
      </div>
    );
  }
}
```

Result:
![Table result](https://firebasestorage.googleapis.com/v0/b/reastrap-e4e1f.appspot.com/o/table.png?alt=media&token=7f23397c-46a6-4049-873c-38303f412270)

---
_Source: https://npm.io/package/react-bootstrap-table-pro · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
