# react-xtable

> A React.js datatable component

Latest version **1.1.0** (published 2018-07-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-xtable
pnpm add react-xtable
yarn add react-xtable
bun add react-xtable
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-07-10 |
| First published | 2018-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 43.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | bernagl |
| Maintainers | bernagl |

## Links

- npm: https://www.npmjs.com/package/react-xtable
- Repository: https://github.com/bernagl/react-xtable
- Homepage: https://github.com/bernagl/react-xtable#readme
- Issues: https://github.com/bernagl/react-xtable/issues
- npm.io page: https://npm.io/package/react-xtable

## Recent versions

- 1.1.0 (latest) — 2018-07-10
- 1.0.9 — 2018-07-09
- 1.0.8 — 2018-07-09
- 1.0.7 — 2018-07-05
- 1.0.6 — 2018-06-06
- 1.0.5 — 2018-06-02
- 1.0.4 — 2018-06-01
- 1.0.3 — 2018-05-28
- 1.0.2 — 2018-05-27
- 1.0.1 — 2018-05-27
- 1.0.0 — 2018-05-27

## README

# react-xtable

> A React.js datatable component

[![NPM](https://img.shields.io/npm/v/react-xtable.svg)](https://www.npmjs.com/package/react-xtable) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save react-xtable
```

## Usage

---

```jsx
import React, { Component } from 'react'

import Rtable from 'react-xtable'
import 'react-xtable/styles.css'

const columns = [
  {
    label: 'Name',
    key: 'name',
    Render: element => <span>{element.name}</span>
  },
  { label: 'Age', key: 'age' },
  {
    label: 'Actions',
    key: 'actions',
    Render: element => <span onClick={() => console.log(element)}>View</span>
  }
]

const data = [{ name: 'Daniela Merlo', age: 22 }]

class Example extends Component {
  render() {
    return (
      <RTable
        data={data}
        columns={columns}
        Loading={() => 'Loading'}
        pagination={10}
        searchPlaceholder="Search"
        emptyText={() => 'No data found :('}
      />
    )
  }
}
```

## Props

| Prop              | Type     | Default | Description                 |
| ----------------- | -------- | ------- | --------------------------- |
| data              | Array    | []      | Data to display             |
| columns           | Array    | []      | Table columns               |
| Loading           | Function |         | Loading indicator           |
| Pagination        | Number   | 50      | Number of elements per page |
| EmptyText         | Function |         | Text to show when no data   |
| search            | Boolean  | true    | Show/Hide search input      |
| searchPlaceholder | Text     | search  | Search input placeholder    |
| title             | Boolean  | true    | Show/Hide datatable title   |

## Column Options

| Property | Type     | Description                                                                           |
| -------- | -------- | ------------------------------------------------------------------------------------- |
| label    | String   | Column title                                                                          |
| key      | String   | Object key                                                                            |
| Render   | Function | Component to render instead of key value. Returns component with the selected element |

## License

MIT © [bernagl](https://github.com/bernagl)

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