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

material-table

Package Overview
Dependencies
Maintainers
1
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

material-table

Datatable for React based on https://material-ui.com/api/table/ with additional features

  • 0.9.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47K
decreased by-3.23%
Maintainers
1
Weekly downloads
 
Created
Source

material-table

Build Status npm package NPM Downloads Follow on Twitter

Datatable for React based on https://material-ui.com/api/table/ with additional features

DEMO

Installation

npm install material-table --save

Usage

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import MaterialTable from 'material-table'

class App extends Component {
  render() {
    return (
      <div style={{maxWidth: '100%'}}>
        <MaterialTable
          columns={[
            {title: 'Adı', field: 'name'},
            {title: 'Soyadı', field: 'surname'},
            {title: 'Doğum Yılı', field: 'birthYear', type: 'numeric'},
            {title: 'Doğum Yeri', field: 'birthCity', lookup: {34: 'İstanbul', 63: 'Şanlıurfa'}}
          ]}
          data={[{name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63}]}
          title="Demo Title"
        />
      </div>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('react-div'));

Properties

PropertyTypeDefaultDescription
actionsArrayAction list. An icon button will be rendered for each actions
columnsArrayColumn definitions
dataArrayData to be rendered
optionsobjectAll options of table
titlestring'Table Title'Table Title (only render if toolbar option is true
actions
FieldTypeDefaultDescription
iconstringIcon of button from material icons
onClickfuncThis event will be fired when button clicked. Parameters are event and row or rows
tooltipstringTooltip for button
columns
FieldTypeDefaultDescription
hiddenbooleanfalseFlag for hide column
fieldstringField name of data row
lookupobjectKey value pair for lookup render data from
renderfuncRender a custom node for cell. Parameter is rowData and return value must be ReactElement
titlestringHeader text
typestrignData type: 'boolean', 'numeric'
data

Data must be array of objects which has fields defined in columns. For example:

const data=[
    {name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63},
    {name: 'Zerya Betül', surname: 'Baran', birthYear: 2017, birthCity: 34},    
]
    
options

Options property could be given to component as options property. You can change behaviour of grid.

FieldTypeDefaultDescription
columnsButtonbooleanfalseFlag for columns button that controls which column could be rendered
filteringbooleanfalseFlag for filtering row
pagingbooleantrueFlag for paging feature
pageSizenumeric5Number of rows that would be rendered on every page
pageSizeOptionsarray[5, 10, 20]Page size options that could be selected by user
searchbooleantrueFlag for search feature
selectionbooleanfalseFlag for selection feature
toolbarbooleantrueFlag for toolbar

Licence

This project is licensed under the terms of the MIT license.

Keywords

FAQs

Package last updated on 12 Oct 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