ka-table

Lightweight MIT React Table component with Sorting, Filtering, Grouping, Vi...

README

The customizable, extendable, lightweight and free React Table Component


Table

Installation


npm

  1. ```sh
  2. npm install ka-table
  3. ```

yarn

  1. ```sh
  2. yarn add ka-table
  3. ```

Usage


Basic example


  1. ```js
  2. import 'ka-table/style.css';

  3. import React from 'react';

  4. import { Table } from 'ka-table';
  5. import { DataType, EditingMode, SortingMode } from 'ka-table/enums';

  6. const dataArray = Array(10)
  7.   .fill(undefined)
  8.   .map((_, index) => ({
  9.     column1: `column:1 row:${index}`,
  10.     column2: `column:2 row:${index}`,
  11.     column3: `column:3 row:${index}`,
  12.     column4: `column:4 row:${index}`,
  13.     id: index,
  14.   }));

  15. const OverviewDemo: React.FC = () => {
  16.   return (
  17.     <Table
  18.       columns={[
  19.         { key: 'column1', title: 'Column 1', dataType: DataType.String },
  20.         { key: 'column2', title: 'Column 2', dataType: DataType.String },
  21.         { key: 'column3', title: 'Column 3', dataType: DataType.String },
  22.         { key: 'column4', title: 'Column 4', dataType: DataType.String },
  23.       ]}
  24.       data={dataArray}
  25.       editingMode={EditingMode.Cell}
  26.       rowKeyField={'id'}
  27.       sortingMode={SortingMode.Single}
  28.     />
  29.   );
  30. };

  31. export default OverviewDemo;
  32. ```