npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

responsive-react-datatable

v2.1.8

Published

A modern, responsive React DataTable component for React applications. Supports sorting, filtering, pagination, and customizable columns — ideal for building interactive, data-driven interfaces that look great on any screen size.

Downloads

320

Readme

📊 Responsive React DataTable

npm npm version license

Responsive React DataTable — A modern, responsive React DataTable component for React applications.
Supports sorting, filtering, pagination, and customizable columns — ideal for building interactive, data-driven interfaces that look great on any screen size.

🎯 Click here to view the live demo

Responsive React DataTable Demo


🚀 Features of Responsive React DataTable

  • 📱 Responsive design for desktop and mobile
  • 🔄 Multiple data modes: Internal, External, Static
  • 🔍 Pagination, search, sorting, selection, and column reordering
  • 📏 Auto page size calculation
  • 🎨 Customizable themes
  • 🌐 Multi-language support (English, Persian, RTL)

⚙️ Installation

npm install responsive-react-datatable

Required Dependencies

Make sure you have the following installed:

npm install @tanstack/react-query axios swiper

🧩 Usage Example — Internal Mode

import Table, {
  ColumnType,
  rowRenderer,
  ActionDropDown,
} from "responsive-react-datatable";
const columns: ColumnType[] = [
  {
    data: "avatar",
    title: "Profile",
    searchable: false,
    orderable: false,
    width: 80,
    render: rowRenderer((_cell, _row) => (
      <img src={_cell} alt={_row?.profileAlt} />
    )),
  },
  {
    data: "name",
    title: "Name",
    searchable: true,
    orderable: true,
    width: 150,
  },
  // if it is an operation column, it must be null.
  {
    data: null,
    orderable: false,
    title: "Operation",
    searchable: false,
    width: 140,
    render: rowRenderer(() => (
      <ActionDropDown
        options={[
          { label: "detail", href: "https://example.com" },
          { label: "show alert", onClick: () => alert("hi") },
        ]}
      />
    )),
  },
];

const internalApiConfig = {
  endpoint: "/api/data",
  baseUrl: "https://example.com",
  method: "POST",
  defaultSortBy: "id",
  sortType: "desc",
  customBody: [{ someFilter: "value" }],
  headers: { Authorization: "Bearer token" },
  onFetch: (data) => console.log("Fetched:", data),
};

<Table
  columns={columns}
  mode="internal"
  internalApiConfig={internalApiConfig}
  pageSize={10}
  lang="en"
  notify={(message, type) => console.log(`${type}: ${message}`)}
/>;

📦 Internal Mode Payload Structure

In Internal Mode, the table generates a default payload for server requests, inspired by DataTables.net:

let payload: Record<string, any> = {
  draw: currentPage,
  columns: makeCurrentCols,
  order: order || [],
  start: (currentPage - 1) * dynamicPageSize,
  length: dynamicPageSize,
  search: { value: searchText || "", regex: false, fixed: [] },
};

📦 Static Mode Example

const staticRows = [{ id: 1, name: "max", age: 30 }];

<Table
  columns={columns}
  mode="static"
  staticRows={staticRows}
  totalItems={staticRows.length}
  pageSize={5}
/>;

⚙️ Props Reference

| Prop | Type | Default | Description | | ------------------ | --------------------------------------------- | ------- | --------------------------------------------------------------------- | | columns | ColumnType[] | [] | Column definitions | | mode | 'internal' \| 'external' \| 'static' | - | Table mode | | internalApiConfig | object | — | Internal API config | | staticRows | any[] | [] | Static rows | | externalRows | any[] | [] | External rows | | totalItems | number | 0 | Total row count | | pageSize | number | 10 | Rows per page | | isSelectable | boolean | false | Enable row selection | | selectedKey | string | 'id' | Key for selected rows | | onSelectChange | (selectedIds: any[]) => void | - | Callback for selection | | pageQueryName | string | 'page' | Query param name for pagination. | | startMobileSize | number | 768 | Breakpoint for mobile detection (e.g., 768). | | colorTheme | ColorTheme | Default | Custom theme colors | | textsConfig | object | Default | Override table texts | | lang | 'en' \| 'fa' | 'en' | Language | | noSearch | boolean | false | don't show search box | | saveSearch | boolean | false | save search value in sessionStorage | | columnNumber | number | 0 | Enable column reordering ( column: columnNumber ) | | notify | (text:string,type:"warning" | "error")=>void | — | return error message after calling api in "internal" mode | | isLoading | boolean | false | Loading state | | autoPageSizeConfig | AutoPageSizeConfig | Default | Auto page size settings (Show number of rows relative to page height) | | height | string | Auto | Table max-height (example:"80vh") | | onPageChange | function | — | Page change callback | | onSortChange | function | — | Sort change callback | | onSearch | function | — | Search callback | | onPageSizeChange | (size: number) => void | - | Page size change callback | | listMode | boolean | false | Mobile list view mode |