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

@manikantsharma/react-table

v1.1.1

Published

A powerful, accessible React table component built with MUI Joy

Downloads

25

Readme

React Table

A powerful, accessible React table component built with MUI Joy. Features sorting, pagination, row selection, column visibility, and loading states.

Features

  • 🔥 Full-featured: Sorting, pagination, row selection, column filtering
  • Accessible: ARIA labels, keyboard navigation, screen reader support
  • 🎨 Customizable: Extensive theming and styling options
  • Performance: Optimized with React.memo and useMemo
  • 📱 Responsive: Mobile-friendly design
  • 🦴 Loading States: Skeleton loading for better UX
  • 🔧 TypeScript: Full type safety out of the box
  • 🎯 MUI Joy: Built on top of Material-UI's Joy design system

Installation

npm install @manikantsharma/react-table
# or
yarn add @manikantsharma/react-table
# or
pnpm add @manikantsharma/react-table

Peer Dependencies

Make sure you have these peer dependencies installed:

npm install react react-dom @mui/joy @mui/icons-material @mui/utils

Quick Start

import React from "react";
import { CustomTable, CustomTableColumn } from "@manikantsharma/react-table";

interface Person {
  id: number;
  name: string;
  age: number;
  email: string;
}

const columns: CustomTableColumn<Person>[] = [
  {
    key: "name",
    dataIndex: "name",
    title: "Name",
    sortable: true,
  },
  {
    key: "age",
    dataIndex: "age",
    title: "Age",
    sortable: true,
    align: "center",
  },
  {
    key: "email",
    dataIndex: "email",
    title: "Email",
  },
];

const data: Person[] = [
  { id: 1, name: "John Doe", age: 30, email: "[email protected]" },
  { id: 2, name: "Jane Smith", age: 25, email: "[email protected]" },
];

function App() {
  return (
    <CustomTable
      columns={columns}
      dataSource={data}
      rowKey="id"
      toolbar={{
        title: "Users",
        showColumnFilter: true,
      }}
      pagination={{
        pageSize: 10,
        showSizeChanger: true,
      }}
    />
  );
}

API Reference

CustomTable Props

| Property | Type | Default | Description | | -------------- | --------------------------------------------------- | ------- | --------------------------- | | columns | CustomTableColumn<T>[] | - | Column configuration | | dataSource | T[] | - | Data to display | | rowKey | string \| (record: T) => string | 'id' | Unique key for each row | | loading | boolean | false | Loading state | | pagination | TablePagination \| false | - | Pagination configuration | | rowSelection | TableRowSelection<T> | - | Row selection configuration | | toolbar | TableToolbar | - | Toolbar configuration | | size | 'sm' \| 'md' \| 'lg' | 'md' | Table size | | bordered | boolean | true | Show border | | onSortChange | (field: string, order: SortOrder \| null) => void | - | Sort change callback |

Column Configuration

interface CustomTableColumn<T> {
  key: string;
  dataIndex: keyof T;
  title: string;
  width?: string | number;
  align?: "left" | "center" | "right";
  sortable?: boolean;
  render?: (value: any, record: T, index: number) => React.ReactNode;
  ellipsis?: boolean;
  hidden?: boolean;
}

Row Selection

const rowSelection = {
  type: "checkbox", // or 'radio'
  selectedRowKeys: selectedKeys,
  onChange: (keys, rows) => {
    setSelectedKeys(keys);
  },
  getCheckboxProps: (record) => ({
    disabled: record.disabled,
  }),
};

Custom Rendering

const columns = [
  {
    key: "status",
    dataIndex: "status",
    title: "Status",
    render: (value, record) => (
      <Chip color={value === "active" ? "success" : "neutral"}>{value}</Chip>
    ),
  },
];

Advanced Usage

Using Individual Components

import {
  EnhancedTableHead,
  EnhancedTableToolbar,
  useTableSelection,
  useTableSorting,
} from "@manikantsharma/react-table";

// Build your own custom table using the building blocks

Custom Hooks

import {
  useTableSelection,
  useTableSorting,
  useColumnVisibility,
} from "@manikantsharma/react-table";

function MyCustomTable() {
  const { selected, handleClick, handleSelectAllClick } = useTableSelection(
    data,
    rowSelection
  );

  const { order, orderBy, handleRequestSort } = useTableSorting(onSortChange);

  const { visibleColumns, handleVisibilityChange } =
    useColumnVisibility(columns);

  // Your custom table implementation
}

Examples

With Loading State

<CustomTable
  columns={columns}
  dataSource={data}
  loading={isLoading}
  rowKey="id"
/>

With Custom Actions

<CustomTable
  columns={columns}
  dataSource={data}
  toolbar={{
    title: "Users",
    actions: <Button startDecorator={<AddIcon />}>Add User</Button>,
    onDelete: (selectedKeys) => {
      // Handle bulk delete
    },
  }}
  rowSelection={{
    type: "checkbox",
    onChange: (keys, rows) => setSelected(rows),
  }}
/>

With Custom Cell Rendering

const columns = [
  {
    key: "avatar",
    dataIndex: "avatar",
    title: "Avatar",
    render: (avatar, record) => <Avatar src={avatar} alt={record.name} />,
  },
  {
    key: "actions",
    dataIndex: "id",
    title: "Actions",
    render: (id) => (
      <Box sx={{ display: "flex", gap: 1 }}>
        <IconButton size="sm" onClick={() => edit(id)}>
          <EditIcon />
        </IconButton>
        <IconButton size="sm" color="danger" onClick={() => delete id}>
          <DeleteIcon />
        </IconButton>
      </Box>
    ),
  },
];

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT © Mani Kant Sharma

Changelog

v1.0.0

  • Initial release
  • Full table functionality with sorting, pagination, selection
  • TypeScript support
  • MUI Joy integration
  • Accessibility features