Git Product home page Git Product logo

react-table's Introduction

React Table Component

A versatile React table component with features like pagination, sorting, and instant filtering.

Features

  • Pagination: Display a specified number of records per page with "Next" and "Previous" buttons. Options for records per page include 10, 25, 50, and 100.
  • Sorting: Sort records by any header in ascending or descending order by clicking on the header.
  • Instant Filter and Search: Filter records by any keyword in the provided data.

Installation

To install the package, run the following command:

npm install react-table-search-sort-paginate

Usage

Props

  • dataSource: The data to be displayed in the table.
  • columns: An array of objects defining the columns of the table. Each object should have the following properties:
    • title: The header title to be displayed.
    • dataIndex: The key in the dataSource to be displayed in this column.
    • key: A unique identifier for the column.

Example

import React from "react";
import Table from "react-table-search-sort-paginate";

const records = [
  {
    "First name": "John",
    "Last name": "Doe",
    "Birth date": "01/01/1990",
    Street: "123 Main St",
    City: "Boston",
    State: "MA",
    ZIP: "02108",
    Department: "Sales",
    "Start date": "03/15/2023",
  },
];

const dataSource = Array.from(records);

const columns = [
  {
    title: "First Name",
    dataIndex: "First name",
    key: "First name",
  },
  {
    title: "Last Name",
    dataIndex: "Last name",
    key: "Last name",
  },
  {
    title: "Birth Date",
    dataIndex: "Birth date",
    key: "Birth date",
  },
  {
    title: "Street",
    dataIndex: "Street",
    key: "Street",
  },
  {
    title: "City",
    dataIndex: "City",
    key: "City",
  },
  {
    title: "State",
    dataIndex: "State",
    key: "State",
  },
  {
    title: "ZIP",
    dataIndex: "ZIP",
    key: "ZIP",
  },
  {
    title: "Department",
    dataIndex: "Department",
    key: "Department",
  },
  {
    title: "Start Date",
    dataIndex: "Start date",
    key: "Start date",
  },
];

const App = () => {
  return <Table dataSource={dataSource} columns={columns} />;
};

react-table's People

Contributors

a-melouk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.