# react-view-table

> Simple react table

Latest version **0.2.4** (published 2018-09-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-view-table
pnpm add react-view-table
yarn add react-view-table
bun add react-view-table
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2018-09-13 |
| First published | 2018-09-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alex Simonok |
| Maintainers | asimonok |
| Keywords | react, table |

## Links

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

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 0.2.4 (latest) — 2018-09-13
- 0.2.3 — 2018-09-13
- 0.2.2 — 2018-09-13
- 0.2.1 — 2018-09-13
- 0.2.0 — 2018-09-13
- 0.1.3 — 2018-09-09
- 0.1.2 — 2018-09-09
- 0.1.1 — 2018-09-09
- 0.1.0 — 2018-09-09
- 0.0.1 — 2018-09-09

## README

# react-view-table
Small, simple and fast react table component.

###[Demos](https://asimonok.github.io/react-view-table/)

## Installation
Run the following command:
`npm i --save react-view-table`

## Using
``` jsx
const data = [
  {
    name: 'John',
    age: 26,
    email: 'john@test.test',
  },
  {
    name: 'Amanda',
    age: 24,
    email: 'amanda@test.test',
  },
]

const columns = [
  {
    label: 'Name',
    accessor: 'name',
    width: 150,
  },
  {
    label: 'Age',
    accessor: 'age',
    width: 70,
  },
  {
    label: 'Email',
    accessor: 'email',
    width: 200,
  },
]

<ReactViewTable
   data={data}
   columns={columns}
/>
 
```


## Documentation

### Component Props

| Prop Name              |   Type   | Required? | Description                                                                     |
|------------------------|:--------:|:---------:|---------------------------------------------------------------------------------|
| data                   |   array  |     ✓     | Data of table                                                                   |
| columns                |   array  |     ✓     | Columns definition. See column params                                           |
| maxHeight              | number   |           | Max table height                                                                |
| noResultRenderer       | function |           | No result renderer                                                              |
| tableClassName         | string   |           | Table className. Value is default `ReactViewTable-table`                        |
| headerClassName        | string   |           | Table header className. Value is default `ReactViewTable-header`                |
| headerContentClassName | string   |           | Table header content className. Value is default `ReactViewTable-headerContent` |
| headerCellClassName    | string   |           | Table header cell className. Value is default `ReactViewTable-headerCell`       |
| bodyClassName          | string   |           | Table body className. Value is default `ReactViewTable-body`                    |
| rowClassName           | string   |           | Table row className. Value is default `ReactViewTable-row`                      |
| cellClassName          | string   |           | Table cell className. Value is default `ReactViewTable-cell`                    |

### Column params

| Name               |   Type   | Required? | Description                 |
|--------------------|:--------:|:---------:|-----------------------------|
| label              |  string  |     ✓     | Header cell label           |
| accessor           |  string  |     ✓     | Key of data                 |
| width              |  number  |           | Cell width. Value is default `100`                  |
| headerCellRenderer | function |           | Custom header cell renderer |
| cellRenderer       | function |           | Custom cell renderer        |

### Header Cell Renderer

``` jsx
const headerCellRenderer = ({ style, key, label }) => (
  <div className='headerCell' style={style} key={key}>
    {label}
  </div>
)
```

### Body Cell Renderer

``` jsx
const bodyCellRenderer = ({ style, key, accessor, row }) => (
  <div className='cell' style={style} key={key}>
    {row[accessor]}
  </div>
)
```

### NoResult Renderer

``` jsx
const noResult = ({ width, height }) => (
  <div className='ReactViewTable-noResult' style={{ width, height }}>
    No Result
  </div>
)
```

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