1.1.4 • Published 5 months ago

nillys-react-table-library v1.1.4

Weekly downloads
-
License
NRTL-NonCommercia...
Repository
-
Last release
5 months ago

Nillys React Table Library (NRTL)

Nillys React Table Library (NRTL) is a customizable and easy-to-use React component for displaying data tables with features like sorting, pagination, and search. This library allows you to customize the table's styles and behavior to suit your needs.

demo

Installation

To install this package, use npm:

npm install nillys-react-table-library

Usage

Here is a basic example of how to use the NRTL component in your React project:

import React from 'react'
import { NRTL } from 'nillys-react-table-library'
import "nillys-react-table-library/style";

const App = () => {
  const datas = {
    tableHead: ['Name', 'Age', 'Profession'],
    tableBody: [
      ['Alice', '30', 'Engineer'],
      ['Bob', '25', 'Designer'],
      ['Charlie', '35', 'Manager'],
    ],
  }

  return (
    <div>
      <h1>Customizable Table</h1>
      <NRTL
        datas={datas}
        headerBackgroundColor="lightblue"
        rowHoverColor="lightgray"
        showPagination={true}
        enableColumnSorting={true}
      />
    </div>
  )
}

export default App

Props

The NRTL component comes with a wide range of customization options. Below is a list of available props with their default values.

PropTypeDescriptionDefault
datasINRTLThe data for the table, containing tableHead (column titles) and tableBody (row data).Required
headerBackgroundColorstringBackground color of the table header.linear-gradient(to left, #d5e065, #a8c24e)
headerHoverBackgroundColorstringBackground color of the table header on hover.#a8c24e
textColorstringColor of the text inside the table.#36395a
rowColorstringBackground color of the table rows.#ffffff
rowHoverColorstringBackground color of the rows when hovered.#36395a
hoverTextColorstringText color in the rows when hovered.#ffffff
disabledButtonColorstringColor of disabled buttons (pagination buttons, etc.).#dcdcdc
columnSortingColorstringColor of the sorting indicator chevron.#dcdcdc
columnSortingFullFilledColorstringColor of the chevron when a column is sorted.#36395a
showSearchBarbooleanDisplays or hides the search bar above the table.false
showItemsPerPageSelectorbooleanDisplays or hides the items-per-page selector.false
showPaginationbooleanDisplays or hides pagination controls.false
showPreviousNextButtonsbooleanDisplays or hides the previous/next buttons in pagination.false
enableColumnSortingbooleanEnables or disables sorting by column.false
itemsPerPageOptionsnumber[]Array of options for the number of items per page.[25, 50, 100]
languageEn Fr stringLanguage of table elements.En

Data Structure (INRTL)

The datas prop expects an object of type INRTL, which contains the table header and body data.

interface INRTL {
  tableHead: string[] // The column headers
  tableBody: string[][] // The table rows as arrays of strings
}

Example:

{
  "tableHead": ["Name", "Age", "Profession"],
  "tableBody": [
    ["Alice", "30", "Engineer"],
    ["Bob", "25", "Designer"],
    ["Charlie", "35", "Manager"]
  ]
}

Advanced Example

Here's an example that showcases more customization options:

import React from 'react'
import { NRTL } from 'nillys-react-table-library'
import "nillys-react-table-library/style";

const App = () => {
  const datas = {
    tableHead: ['Name', 'Age', 'Profession'],
    tableBody: [
      ['Alice', '30', 'Engineer'],
      ['Bob', '25', 'Designer'],
      ['Charlie', '35', 'Manager'],
    ],
  }

  return (
    <div>
      <h1>Advanced Table Customization</h1>
      <NRTL
        datas={datas}
        headerBackgroundColor="lightblue"
        headerHoverBackgroundColor="darkblue"
        textColor="black"
        rowColor="white"
        rowHoverColor="lightgray"
        columnSortingColor="gray"
        columnSortingFullFilledColor="blue"
        showSearchBar={true}
        showPagination={true}
        enableColumnSorting={true}
        itemsPerPageOptions={[5, 10, 25]}
        language={'Fr'}
      />
    </div>
  )
}

export default App

License

This project is licensed under the NRTL-NonCommercial license. You are free to use, modify, and distribute this project for internal, non-commercial purposes. Please read the LICENSE.md file for more details.

1.1.4

5 months ago

1.1.3

8 months ago

1.1.1

8 months ago

1.1.2

8 months ago

1.1.0

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago