Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-expandable-table

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-expandable-table

Lightweight, flexible react table component, with the ability to expand rows.

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

NameTypeDefaultRequiredDescription
columnsarrayOf(shape)[]falseSee column props below
dataSourcearrayOf(object)[]falseAn array of objects, each containing key-value pairs, where the keys correspond to column keys
emptyTextstring'No Data'falseText to be displayed when dataSource is empty or undefined
expandButtonRenderfuncfalseOptional custom render to be used for the row expand button. Make sure your custom node calls the provided onClick function. Optionally, you can also use the provided isExpanded boolean if you'd like to conditionally render based on the current row's isExpanded state

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):void

onRowExpandfuncfalseFunction 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

NameTypeDefaultRequiredDescription
keystringtruefalseUnique identifier used to identify this column.
dataTooltipfuncfalseFunction to generate a custom tooltip string for the specific data cell. If not provided, the tooltip will default to `cellData` if it can be parsed into a string. `Function(cellData, rowData):string`
renderfuncfalseOptional custom render to be used for the column data cell. `Function(cellData, rowData, rowIndex):ReactNode|[ReactNode]`
titlenodefalseOptional custom node to be used for the column title.
titleTooltipstringfalseOptional tooltip for the column's title (th), defaults to `column.title` (if string parsable)
widthnumberfalseOptional number to be used to represent what percentage of the total width this column should span. Similar to the css `flex-grow` property.

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

FAQs

Package last updated on 16 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc