0.0.1 • Published 4 years ago

@ashiknesin/react-tiny-table v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

react-tiny-table

Simple table library for React

NPM JavaScript Style Guide

Install

npm install --save react-tiny-table

Usage

import React, { Component } from 'react'

import TinyTable from '@ashiknesin/react-tiny-table'


 const columns = [
            {
                title: 'Subscription Info',
                dataIndex: 'subscriptionInfo',
                key: 'subscriptionInfo',
                fixed: 'left' // To make it fixed (left)
            },
            {
                title: 'Customer Info',
                dataIndex: 'customerInfo',
                key: 'customerInfo'
            },
            {
                title: 'MRR',
                dataIndex: 'mrr',
                key: 'mrr'
            },
            {
                title: 'Created On',
                dataIndex: 'createdOn',
                key: 'createdOn',
                fixed: 'right'
                // To make it fixed (right)
            },
            {
                title: 'Custom Field Right',
                dataIndex: 'customField',
                key: 'customField'
            }
];

const dataset = [
    {
        subscriptionInfo: 'Ashik Nesin',
        customerInfo: 'cloud---entry',
        customerEmail: 'mail@ashiknesin.com',
        customerWebsite: 'https://nesin.io',
        nextRenewal: '17 Feb 2020',
        mrr: '$50.00 USD',
        createdOn: '22 Jan 2020',
        customField: 'Demo'
    }
];

const data =  Array.from({ length: 50 }).map(x => dataset[0]);

class TinyTableDemo extends Component {
  render () {
    return (
        <TinyTable columns={columns} dataSource={data} />
    )
  }
}

License

MIT © AshikNesin