0.2.8 • Published 3 months ago

usereactable v0.2.8

Weekly downloads
-
License
-
Repository
github
Last release
3 months ago

UseReactTable

UseReactTable is a React package that provides fast, flexible, and simple data tables for displaying tabular data. It supports features such as sorting, filtering, and pagination and is built on the power of React.js.

Features

  • Single Component Integration: Easily integrate a feature-rich data table with just one component.
  • Customizable: Tailor the appearance and behavior of the table to meet your specific requirements.
  • Pagination, Sorting, Search, Filtering: Efficiently manage and display data with built-in features.
  • Resizable Columns: Resize columns to optimize the viewing experience.
  • Selection: Support row selection for actions like deletion or further processing.
  • Responsive Design: Ensure a seamless experience across different screen sizes.

Installation

Using NPM

To use UseReactTable in your React project, install it via npm:

npm install --save usereactable

There might be hidden bugs lurking around any corner. I'll try to tag any releases with breaking changes.

Note: Feel free to submit new issues here.

Table of Contents

## Usage/Examples

The simplest example:

import { useEffect, useState } from "react";
import Datatable from "usereactable";

const App = () => {
  const columns = [
    {
      headerName: "First Name",
      field: "firstName",
    },
    {
      headerName: "Last Name",
      field: "lastName",
    },
    {
      headerName: "Maiden Name",
      field: "maidenName",
    },
    {
      headerName: "Maiden Name",
      field: "image",
    },
    {
      headerName: "Age",
      field: "age",
      style: {
        color: "green",
      },
    },
  ];
  const [data, setdata] = useState([]);
  useEffect(() => {
    fetch("https://dummyjson.com/users?limit=100")
      .then((res) => res.json())
      .then((data) => setdata(data.users.slice(0, 100)));
  }, []);

  return (
    <div>
      <Datatable
        rows={data}
        columns={columns}
        title={"Customer list"}
        actionButtons
        excelDownload
        pagination
      />
    </div>
  );
};

export default App;

While pretty basic, this example demonstrates a couple things:

  • Import Datatable from usereacttable
  • Cols in the column that is gone be shown in react table
  • data is rows data which is gone be show in table
  • pagination keyword enable pagination to your table -React DOM attributes such as className will pass-through to the rendered <table>

Screenshots

App Screenshot

Props

NameTypeRequiredDefaultDescription
titlestringYesnullHeading of the table
rowsarrayYes[]array of objects
columnsarrayYesnullList of cols which gone be see in the table
subTitlestringYesundefinedSub-Heading of the table
styleCSS StylesNonullAdd styles to table container
classNamestringNonullAdd className to table container
tableheadstyleCSS StylesNoundefinedchange style of table heading
searchAblebooleanNotrueShow / Hide search box from table
tableheadstyleCSS StylesNoundefinedchange style of table heading
tablerowstyleCSS StylesNoundefinedchange style of table's row
paginationbooleanNofalseAdd pagination to table
actionButtonsbooleanObjectnofalseDisplayed action buttons in the table
selectionbooleanNofalseEnables / disable the row selection in table
excelDownloadbooleanNofalseEnables / disable the feature of download data in excel file
removefromExcelbooleanNoundefinedRemoves the key's from excel file from download
onEditBtnClickfunctionNoundefinedFunction on edit button click
onDeleteBtnClickfunctionNoundefinedFunction on delete button click
keysToExcludeFromViewstring[]Noundefinedhide keys from default view model
viewButtonReact ElementNoundefinedAdd custom view button in the table
editButtonReact ElementNoundefinedAdd custom edit button in the table
deleteButtonReact ElementNoundefinedAdd custom delete button in the table
modalClassNamestringNoundefinedadd classname to modal container
modalStyleReact Css PropertiesNoundefinedTo change modal style
0.2.7

3 months ago

0.2.6

3 months ago

0.2.8

3 months ago

0.2.5

5 months ago

0.2.1

5 months ago

0.2.3

5 months ago

0.2.2

5 months ago

0.2.4

5 months ago

0.2.0

6 months ago

0.1.9

6 months ago

0.1.8

6 months ago

0.1.7

6 months ago

0.1.6

6 months ago

0.1.5

6 months ago

0.1.4

6 months ago

0.1.3

6 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago