react-data-table-tailwind
TypeScript icon, indicating that this package has built-in type declarations

1.0.16 • Public • Published

React Data Table with Tailwind CSS

This project is a React component for displaying data in a table format, styled with Tailwind CSS. It supports features like pagination, loading state, and dark mode.

Installation

  1. Install dependencies:
    npm i react-data-table-tailwind

Usage

Import the DataTable component and use it in your React application:

import React from "react";
import { DataTable } from "./src/DataTable";
import "./src/index.css";

const columns = [
  { header: "Name", accessor: "name" },
  { header: "Age", accessor: "age" },
  { header: "Email", accessor: "email" },
];

const data = [
  { name: "John Doe", age: 30, email: "john@example.com" },
  { name: "Jane Smith", age: 25, email: "jane@example.com" },
];

function App() {
  return (
    <div className="App">
      <DataTable
        columns={columns}
        data={data}
        loading={false}
        usePagination={true}
        totalPages={5}
      />
    </div>
  );
}

export default App;

Props

The DataTable component accepts the following props:

  • columns: An array of column definitions.
  • data: An array of data objects.
  • loading: A boolean indicating if the data is loading.
  • usePagination: A boolean indicating if pagination should be used.
  • totalPages: The total number of pages (required if usePagination is true).
  • onPageChange: A function to handle page changes.
  • dark: A boolean to enable dark mode.

License

This project is licensed under the ISC License.


Feel free to customize the README further based on your specific needs.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.167latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.167
1.0.152
1.0.142
1.0.132
1.0.122
1.0.111
1.0.102
1.0.92
1.0.81
1.0.71
1.0.61
1.0.51
1.0.42
1.0.31
1.0.21
1.0.11
1.0.01

Package Sidebar

Install

npm i react-data-table-tailwind

Weekly Downloads

30

Version

1.0.16

License

ISC

Unpacked Size

19.4 kB

Total Files

17

Last publish

Collaborators

  • cosminciolacu