0.0.1 • Published 1 year ago

react-table-component-ll-oc v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

React Data Table Component

react-data-table-ll is a simple and flexible React table component for displaying data.

Key Features

  • Declarative configuration
  • Built-in and configurable:
    • Sorting
    • Filtering
    • Pagination
  • Style Customizable

Installation

  npm install --save react-table-component-ll-oc

Usage

import

 import { DataTable } from 'react-table-component-ll-oc'

simple use

 const data = {
  columns: [
    {
      name:'Name',
      value:'name',
      type:'string',
      sortable:true
    },
    {
      name:'Age',
      value: 'age',
      type:'number',
      sortable:false
    }
  ],
  rows: [
    {
      name: 'Linh Dang',
      age: 36
    },
    { 
      name: 'Liam Dan',
      age: 1
    },
    {
      name: 'Bui Huu Kien',
      age: 35
    }
  ]
}

<DataTable data = {data} titleTbl = {'your title'}/>

Filtering and Pagination

paginationConfig = {
  nbrRows:6 
}

<DataTable data = {data} searchTbl pagination  paginationConfig={paginationConfig}/>

Style Customizable

style.css file

.table_title_ct{
  color: red;
}
.table_filter_ct{
  background: red;
}

component.jsx file

import './style.css';

styleCustom = {
      table_title: 'table_title_ct',
      table_filter: 'table_filter_ct'
}
<DataTable data = {data} titleTbl = {'your title'} searchTbl pagination  paginationConfig styleCustom={styleCustom}/>

style options

proptypevalueDescription
table_sectionstringstyle class nameSection that contains the DataTable component
table_containerstringstyle class nameThe <div> element contains the content of the DataTable
table_headerstringstyle class nameHeader contains the title and filter of the table
table_titlestringstyle class nameThe title of the table
table_filterstringstyle class nameThe filter of the table
table_footerstringstyle class nameFooter contains the pagination section
table_contenu__tablestringstyle class nameThe element <table> contain data of the table
table_contenutheadtrstringstyle class nameThe element <tr> inside element <thead> of the table
table_contenutheadthiconcontainerstringstyle class nameThe icon container of the sorting section
table_contenutheadthiconcolorstringname of colorThe icon color for sorting (Ex.: 'red')
table_contenutheadthiconsizestringsize of iconThe icon size for sorting (Ex.: '1.5rem')
table_contenutheadth__containerstringstyle class nameThe container for the header cell of each column
table_contenutheadth__namestringstyle class nameThe title in the header cell of each column
table_contenutbodytrstringstyle class nameThe element <tr> in the element <tbody> of the table
table_contenutbodytdstringstyle class nameThe element <td> in the element <tbody> of the table
table_pagination__containerstringstyle class nameThe container contains the content of the pagination section
table_paginationselecticon__colorstringname of colorThe icon color in the select menu (Ex.: 'red')
table_paginationselecticon__sizestringsize of iconThe icon size in the select menu (Ex.: '1.5rem')
table_paginationselectcontainerstringstyle class nameThe container contains the select menu
table_paginationselecttitlestringstyle class nameThe title of the seclect menu
table_paginationselectoptionsstringstyle class nameThe option of menu
table_pagination__currentPagestringstyle class nameThe description of the actual data displayed
table_paginationarrowscontainerstringstyle class nameThe conatiner contains the arrows
table_paginationarrowsicon__colorstringname of colorThe double arrow color in the pagination section (Ex.: 'red')
table_paginationarrowsicon__sizestringsize of iconThe double arrow size in the pagination section (Ex.: '1.5rem')

License

0.0.1

1 year ago