Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
5
Weekly downloads
 
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

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

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