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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@allejkomal/react-table-editor

v1.0.3

Published

A powerful, feature-rich React table component with drag & drop, filtering, sorting, pagination, column pinning, and row selection

Readme

React Table Editor

A powerful, feature-rich React table component built with TanStack Table, featuring drag & drop column reordering, advanced filtering, sorting, pagination, column pinning, and row selection capabilities.

✨ Features

  • 🔄 Drag & Drop: Reorder columns with intuitive drag and drop
  • 📌 Column Pinning: Pin columns to left or right for better data visibility
  • 🔍 Advanced Filtering: Multiple filter types (contains, equals, starts with, etc.)
  • 📊 Sorting: Multi-column sorting with visual indicators
  • 📄 Pagination: Built-in pagination with customizable page sizes
  • ✅ Row Selection: Single and multi-row selection with checkboxes/radio buttons
  • 👁️ Column Visibility: Show/hide columns dynamically
  • 📏 Column Resizing: Resize columns with smooth interactions
  • 🔎 Global Search: Search across all columns simultaneously
  • 🎨 Customizable: Extensive configuration options and styling
  • ♿ Accessible: Built with accessibility in mind using Radix UI primitives
  • 📱 Responsive: Works great on desktop and mobile devices

🚀 Installation

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

📦 Peer Dependencies

This package requires the following peer dependencies:

npm install react react-dom tailwindcss

🎨 Required CSS Import

Important: You must import the component styles in your application. The component uses Tailwind CSS classes, so you need Tailwind CSS configured in your project.

Option 1: With Tailwind CSS (Recommended)

If you're using Tailwind CSS in your project:

// Import the component styles
import "@allejkomal/react-table-editor/styles";

// Your other imports
import { TableEditor, ExtendedColumnDef } from "@allejkomal/react-table-editor";

Make sure you have Tailwind CSS configured in your project:

npm install tailwindcss

And include Tailwind in your CSS:

@tailwind base;
@tailwind components;
@tailwind utilities;

Option 2: Without Tailwind CSS

If you're not using Tailwind CSS, you can still use the component, but you'll need to add the Tailwind classes manually or use a CDN:

<!-- Add Tailwind CSS from CDN -->
<script src="https://cdn.tailwindcss.com"></script>

Or install Tailwind CSS just for this component:

npm install tailwindcss
npx tailwindcss init

Then add to your CSS:

@tailwind base;
@tailwind components;
@tailwind utilities;

🎯 Quick Start

import React from "react";
import "@allejkomal/react-table-editor/styles";
import { TableEditor, ExtendedColumnDef } from "@allejkomal/react-table-editor";

// Define your data type
interface User {
  id: string;
  name: string;
  email: string;
  role: string;
  status: "active" | "inactive";
}

// Sample data
const users: User[] = [
  {
    id: "1",
    name: "John Doe",
    email: "[email protected]",
    role: "Admin",
    status: "active",
  },
  {
    id: "2",
    name: "Jane Smith",
    email: "[email protected]",
    role: "User",
    status: "active",
  },
  {
    id: "3",
    name: "Bob Johnson",
    email: "[email protected]",
    role: "User",
    status: "inactive",
  },
];

// Define columns
const columns: ExtendedColumnDef<User>[] = [
  {
    id: "name",
    header: "Name",
    accessorKey: "name",
    enableSorting: true,
    enableColumnFilter: true,
  },
  {
    id: "email",
    header: "Email",
    accessorKey: "email",
    enableSorting: true,
    enableColumnFilter: true,
  },
  {
    id: "role",
    header: "Role",
    accessorKey: "role",
    enableSorting: true,
    enableColumnFilter: true,
  },
  {
    id: "status",
    header: "Status",
    accessorKey: "status",
    enableSorting: true,
    enableColumnFilter: true,
  },
];

function App() {
  return (
    <div className="p-6">
      <h1 className="text-2xl font-bold mb-4">User Management</h1>
      <TableEditor
        data={users}
        columns={columns}
        config={{
          enablePagination: true,
          enableSorting: true,
          enableColumnFilter: true,
          enableColumnPinning: true,
          enableColumnOrder: true,
          enableMultiRowSelection: true,
          enableGlobalFilter: true,
        }}
      />
    </div>
  );
}

export default App;

⚙️ Configuration Options

The TableEditorConfig interface provides extensive customization options:

Pagination

config={{
  enablePagination: true,
  pageSize: 10,
  pageIndex: 0,
  onPageSizeChange: (pageSize) => console.log('Page size changed:', pageSize),
  onPageIndexChange: (pageIndex) => console.log('Page index changed:', pageIndex),
}}

Row Selection

config={{
  // Single row selection
  enableSingleRowSelection: true,
  rowSelection: { '1': true },
  onRowSelectionChange: (selection) => console.log('Selection changed:', selection),

  // Multi row selection
  enableMultiRowSelection: true,
  renderMultiSelection: (row) => <CustomCheckbox row={row} />,
}}

Column Management

config={{
  // Column pinning
  enableColumnPinning: true,
  columnPinning: { left: ['name'], right: ['actions'] },
  onColumnPinningChange: (pinning) => console.log('Pinning changed:', pinning),

  // Column ordering
  enableColumnOrder: true,
  columnOrder: ['name', 'email', 'role'],
  onColumnOrderChange: (order) => console.log('Order changed:', order),

  // Column visibility
  enableColumnVisibility: true,
  initialColumnVisibility: { 'role': false },
  onColumnVisibilityChange: (visibility) => console.log('Visibility changed:', visibility),

  // Column resizing
  enableColumnResizing: true,
  columnResizeMode: 'onChange', // or 'onEnd'
  columnResizeDirection: 'ltr', // or 'rtl'
  onColumnSizingChange: (sizing) => console.log('Sizing changed:', sizing),
}}

Filtering & Sorting

config={{
  // Global search
  enableGlobalFilter: true,
  globalFilter: 'search term',
  globalFilterFn: 'includesString', // or custom function
  onGlobalFilterChange: (filter) => console.log('Global filter:', filter),

  // Column filtering
  enableColumnFilter: true,
  columnFilters: [{ id: 'name', value: { type: 'contains', value: 'John' } }],
  onColumnFiltersChange: (filters) => console.log('Column filters:', filters),

  // Sorting
  enableSorting: true,
  sorting: [{ id: 'name', desc: false }],
  onSortingChange: (sorting) => console.log('Sorting changed:', sorting),
}}

🎨 Column Definition

The ExtendedColumnDef interface extends TanStack Table's ColumnDef with additional properties:

interface ExtendedColumnDef<TData, TValue = unknown>
  extends ColumnDef<TData, TValue> {
  headerAlign?: "left" | "center" | "right";
  cellAlign?: "left" | "center" | "right";
  enablePinning?: boolean;
  enableSorting?: boolean;
  enableResizing?: boolean;
  enableHiding?: boolean;
  enableColumnFilter?: boolean;
}

Example Column Definitions

const columns: ExtendedColumnDef<User>[] = [
  {
    id: "name",
    header: "Full Name",
    accessorKey: "name",
    headerAlign: "left",
    cellAlign: "left",
    enableSorting: true,
    enableColumnFilter: true,
    enablePinning: true,
    enableResizing: true,
    enableHiding: true,
  },
  {
    id: "email",
    header: "Email Address",
    accessorKey: "email",
    headerAlign: "center",
    cellAlign: "center",
    enableSorting: true,
    enableColumnFilter: true,
    cell: ({ getValue }) => (
      <a
        href={`mailto:${getValue()}`}
        className="text-blue-600 hover:underline"
      >
        {getValue()}
      </a>
    ),
  },
  {
    id: "status",
    header: "Status",
    accessorKey: "status",
    headerAlign: "center",
    cellAlign: "center",
    enableSorting: true,
    enableColumnFilter: true,
    cell: ({ getValue }) => {
      const status = getValue() as string;
      return (
        <span
          className={`px-2 py-1 rounded-full text-xs ${
            status === "active"
              ? "bg-green-100 text-green-800"
              : "bg-red-100 text-red-800"
          }`}
        >
          {status}
        </span>
      );
    },
  },
];

🔍 Filter Types

The table supports various filter types:

  • contains - Contains the search term
  • equals - Exact match
  • startsWith - Starts with the search term
  • endsWith - Ends with the search term
  • notEquals - Does not equal
  • notContains - Does not contain
  • isEmpty - Is empty or null
  • isNotEmpty - Is not empty

🎨 Styling

The component uses Tailwind CSS for styling. You need Tailwind CSS configured in your project for the component to display correctly.

Customization Options

You can customize the appearance by:

  1. CSS Variables: Override CSS custom properties for theming
  2. Tailwind Config: Extend your Tailwind configuration to match your design system
  3. Custom Classes: Apply additional classes to override default styles

CSS Variables

The component includes CSS custom properties that you can override:

:root {
  --rt-background: 0 0% 100%;
  --rt-foreground: 222.2 84% 4.9%;
  --rt-primary: 222.2 47.4% 11.2%;
  --rt-primary-foreground: 210 40% 98%;
  --rt-secondary: 210 40% 96%;
  --rt-secondary-foreground: 222.2 84% 4.9%;
  --rt-border: 214.3 31.8% 91.4%;
  --rt-radius: 0.5rem;
}

.dark {
  --rt-background: 222.2 84% 4.9%;
  --rt-foreground: 210 40% 98%;
  --rt-primary: 210 40% 98%;
  --rt-primary-foreground: 222.2 47.4% 11.2%;
  --rt-secondary: 217.2 32.6% 17.5%;
  --rt-secondary-foreground: 210 40% 98%;
  --rt-border: 217.2 32.6% 17.5%;
}

Tailwind Configuration

If you want to customize the component's appearance, you can extend your Tailwind config:

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        background: 'hsl(var(--rt-background))',
        foreground: 'hsl(var(--rt-foreground))',
        primary: {
          DEFAULT: 'hsl(var(--rt-primary))',
          foreground: 'hsl(var(--rt-primary-foreground))',
        },
        // ... other colors
      },
    },
  },
}

📱 Responsive Design

The table is responsive and works well on different screen sizes:

  • Desktop: Full feature set with all interactions
  • Tablet: Touch-friendly interactions with optimized spacing
  • Mobile: Horizontal scrolling with essential features

♿ Accessibility

Built with accessibility in mind:

  • Keyboard Navigation: Full keyboard support for all interactions
  • Screen Readers: Proper ARIA labels and descriptions
  • Focus Management: Clear focus indicators and logical tab order
  • Color Contrast: Meets WCAG guidelines for color contrast

🧪 TypeScript Support

Full TypeScript support with comprehensive type definitions:

import type {
  TableEditorConfig,
  ExtendedColumnDef,
} from "@allejkomal/react-table-editor";

📚 Documentation

🔧 Development

Prerequisites

  • Node.js 18+
  • npm/yarn/pnpm

Setup

git clone https://github.com/allejkomal/react-table-editor.git
cd react-table-editor
npm install

Development Commands

# Start development server
npm run dev

# Build the package
npm run build

# Start local development with HMR
npm start

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📞 Support

If you have any questions or need help, please:

  1. Check the Issues page
  2. Create a new issue if your question isn't answered
  3. Contact the maintainer

🙏 Acknowledgments


Made with ❤️ by Allej Komal