1.1.0 • Published 6 years ago

react-xtable v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

react-xtable

A React.js datatable component

NPM JavaScript Style Guide

Install

npm install --save react-xtable

Usage


import React, { Component } from 'react'

import Rtable from 'react-xtable'
import 'react-xtable/styles.css'

const columns = [
  {
    label: 'Name',
    key: 'name',
    Render: element => <span>{element.name}</span>
  },
  { label: 'Age', key: 'age' },
  {
    label: 'Actions',
    key: 'actions',
    Render: element => <span onClick={() => console.log(element)}>View</span>
  }
]

const data = [{ name: 'Daniela Merlo', age: 22 }]

class Example extends Component {
  render() {
    return (
      <RTable
        data={data}
        columns={columns}
        Loading={() => 'Loading'}
        pagination={10}
        searchPlaceholder="Search"
        emptyText={() => 'No data found :('}
      />
    )
  }
}

Props

PropTypeDefaultDescription
dataArray[]Data to display
columnsArray[]Table columns
LoadingFunctionLoading indicator
PaginationNumber50Number of elements per page
EmptyTextFunctionText to show when no data
searchBooleantrueShow/Hide search input
searchPlaceholderTextsearchSearch input placeholder
titleBooleantrueShow/Hide datatable title

Column Options

PropertyTypeDescription
labelStringColumn title
keyStringObject key
RenderFunctionComponent to render instead of key value. Returns component with the selected element

License

MIT © bernagl

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago