# @shin0602/react-table

> ## Install ```sh yarn add @shin0602/react-table ``` OR ```sh npm -i @shin0602/react-table ```

Latest version **1.0.9** (published 2023-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @shin0602/react-table
pnpm add @shin0602/react-table
yarn add @shin0602/react-table
bun add @shin0602/react-table
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2023-02-27 |
| First published | 2022-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | shin0602 |
| Maintainers | shin0602 |
| Keywords | react, table, viewer |

## Links

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

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## 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

- 1.0.9 (latest) — 2023-02-27
- 1.0.8 — 2023-02-27
- 1.0.7 — 2022-10-09
- 1.0.6 — 2022-09-13
- 1.0.5 — 2022-08-15
- 1.0.4 — 2022-08-15
- 1.0.3 — 2022-08-15
- 1.0.2 — 2022-08-15
- 1.0.1 — 2022-08-12
- 1.0.0 — 2022-08-12

## README

# React Table 

## Install
```sh
yarn add @shin0602/react-table
```
OR
```sh
npm -i @shin0602/react-table
```




## Preview

![react_table](https://user-images.githubusercontent.com/6999412/184323564-a70d3b2e-bfde-46bc-bede-50cbcb836ba2.gif)







### Example
```tsx
import React from 'react'
import TableView from '@shin0602/react-table'

const sampleDatas = [
  {
    id: 1,
    name: 'John Doe',
    age: 32,
    address: {
      postalCode: '12345',
      city: 'New York',
    },
  },
  ...
]


function App() {
  const [page, setPage] = React.useState(1)
  const limit = 5
  return (
    <TableView
      // customClassName='my-table' // if you want to use custom className
      data={sampleDatas}
      // data={[] as typeof sampleDatas}
      page={page}
      limit={limit}
      minWidth={960} // minWidth (px)
      minHeight={'10rem'}
      maxHeight={'10rem'}
      onChangePage={async (page) => setPage(page)}
      columns={{ // display columns
        id: {
          label: 'ID', // display label
          width: 100,  // optional display width (px)
          // align: 'right', // optional display align (left, right, center)
          // render: (value: data[index], index: number, row) => <div>{value}</div>, // optional display render function
        },
        name: {
          label: 'Name',
        },
        age: {
          label: 'Age',
          align: 'right',
        },
        // dot path is supported
        'address.postalCode': {
          label: 'Address',
            render: (_value, _i,row) => (
              <div>
                <p>{row.address.postalCode}</p>
                <p>{row.address.city}</p>
              </div>
            ),
        },
      }}
    />
  )
}

```
### Custom Styles

```stylesheet
// <TableView 
// customClassName='my-table' // class name

.my-table-header {
  background-color: #555;
  color: #fff;
}

.my-table-body {
  background-color: #f3f3f3;
}

.my-table-row {
  background-color: #f9f9f9;
  border: 1px solid gray;
  border-top-width: 0;
  border-right-width: 0;
  border-left-width: 0;
}

.my-table-row:hover {
  background-color: #fafafa;
}

.my-table-colum:hover {
  background-color: #fff;
}

.my-table-footer {
  background-color: #f3f3f3;
}

.my-table-page-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid;
  border-color: color-2;
  transition: all 0.2s ease-in-out;
}
```

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