Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@doctolib/react-autoresize-table

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@doctolib/react-autoresize-table

Autoresize table for React.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
5
Created
Source

react-autoresize-table

Build Status Coverage Status Dependency Status devDependency Status

Autoresize table for React.

Install

npm install @doctolib/react-autoresize-table

Examples

Usage

React.createClass({
  getInitialState() {
    return {nbRows: 1};
  },

  renderRows() {
    range(this.state.nbRows)
      .map(index => (
        <tr key={index}>
          <td>{index}</td>
          <th>Name #{index}</th>
        </tr>
      ));
  },

  onNbVisibleRowsChange(nbRows) {
    this.setState({nbRows});
  },

  render() {
    return (
      <AutoresizeTable onNbVisibleRowsChange={this.onNbVisibleRowsChange}>
        <table>
          <thead>
            <tr>
              <th>#</th>
              <th>Name</th>
            </tr>
          </thead>
          <tbody>{this.renderRows()}</tbody>
        </table>
      </AutoresizeTable>
  }
})

Properties

container

A DOM element that will be used as a container. Defaults to parentElement. If your parent is not in relative position, you can use container to specify a custom container.

<AutoresizeTable container={document}/>

minRowsDisplayed

The minimal row displayed in the table. Defaults to 1.

<AutoresizeTable minRowsDisplayed={4}/>

onNbVisibleRowsChange

Called when the number of visible rows changes.

<AutoresizeTable onNbVisibleRowsChange={nbRows => this.setState({nbRows})}/>

rowHeight

The height of rows. By default it will try to get the height of the first row of your table tbody element.

<AutoresizeTable rowHeight={20}/>

License

MIT

Keywords

react

FAQs

Package last updated on 18 Apr 2016

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