react-expandable-table
v0.0.6
Published
Lightweight, flexible react table component, with the ability to expand rows.
Downloads
29
Readme
react-expandable-table
Installation
The package can be installed via npm by running: npm install
, or npm i
for brevity.
Usage
import Table from 'react-expandable-table';
...
<Table columns={[{ key: 'red' }, { key: 'blue' }]} dataSource={[{ red: true, blue: false }, { red: false, blue: true }]} />
API
Props
Function({ onClick, isExpanded }):ReactNode|[ReactNode]expandCellWidthnumber50falseThe [fixed] width (in pixels) of the expand row button cell.isBorderedboolfalsefalseIf true, the table will be styled with borders.onRowClickfuncfalseFunction to be invoked when a row is clicked.
Function(rowData, rowIndex):voidonRowExpandfuncfalseFunction to be invoked when a row expand icon is clicked The expand icon will be included by default if you provide an onRowExpand function.
Function(rowData, rowIndex):ReactNode|[ReactNode]
Column Props
Development
First, install necessary dependencies:
npm i
Then start up the styleguide server on localhost:6060:
npm start
You can edit or add to the styleguide examples in Table.md
.
To run the test suite:
npm run test
or
npm run test:watch