New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

follow-table

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

follow-table

A flexible and feature-rich React table component

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Follow Table

A flexible and feature-rich React table component with data stewardship capabilities.

Features

  • 📊 Data Visualization - Built-in charts and statistics for column-level analysis
  • 🔍 Advanced Filtering - Filter data by numerical range, categorical values, or date ranges
  • 📋 Sortable Columns - Click column headers to sort data with visual indicators
  • 📄 Pagination - Navigate through large datasets with customizable page sizes
  • Row Selection - Select individual or all rows for batch operations
  • 🔎 Data Inspection - View and edit row details in a modal interface
  • 🔄 API Integration - Built-in support for API data fetching with fallback options
  • 📱 Responsive Design - Adapts to different screen sizes with optimized layouts
  • 🎨 Customizable Actions - Add custom action buttons to rows with full handler control
  • 📤 CSV Export - Export table data to CSV format with server-side or client-side processing
  • 📊 Statistics Side Panel - View detailed statistics for any column without disrupting the table view
  • 🎯 Missing Data Indicators - Visual indicators for data completeness in each column

Installation

npm install follow-table
# or
yarn add follow-table

Usage

Basic Example

import { FollowTable } from 'follow-table';
import 'follow-table/dist/index.css'; // Import styles if needed

function MyComponent() {
  const columns = ['id', 'name', 'email', 'role'];
  const data = [
    { id: 1, name: 'John Doe', email: 'john@example.com', role: 'Admin' },
    { id: 2, name: 'Jane Smith', email: 'jane@example.com', role: 'User' },
    // more data...
  ];

  return (
    <FollowTable
      columns={columns}
      data={data}
      idField="id"
    />
  );
}

With API Integration

import { FollowTable } from 'follow-table';

function ApiTable() {
  return (
    <FollowTable
      databaseId={1}
      tableName="users"
      idField="id"
      actions={['select', 'view', 'edit', 'delete', 'export']}
      actionHandlers={{
        onView: (id, rowData) => console.log(`Viewing row ${id}`, rowData),
        onEdit: (id) => console.log(`Editing row ${id}`),
        onDelete: (id) => console.log(`Deleting row ${id}`),
        onExport: (id) => console.log(`Exporting row ${id}`),
      }}
      layoutOptions={{
        maxHeight: '600px',
        stickyHeader: true,
        fullHeight: true
      }}
    />
  );
}

Props

Core Props

PropTypeRequiredDefaultDescription
columnsstring[]No[]Array of column names to display. If not provided, will be extracted from data.
dataany[]No[]Array of data objects. If not provided, data will be fetched from API.
idFieldstringNo'rowid'Field name to use as unique identifier. Defaults to 'rowid' for SQLite data.

API Integration Props

PropTypeRequiredDefaultDescription
databaseIdstring | numberNo*-Database ID for API integration. Required if data is not provided.
tableNamestringNo*-Table name for API integration. Required if data is not provided.
originalFileNamestringNo-Original file name to display in the table header.

Action Props

PropTypeRequiredDefaultDescription
actionsstring[]No[]Array of actions to enable. Options: 'select', 'view', 'edit', 'delete', 'export'.
actionHandlersobjectNo{}Object of handler functions for actions. Supports: onView, onEdit, onDelete, onSelect, onExport.
onBulkDeletefunctionNo-Handler for bulk delete action. Receives array of selected row IDs.

Sorting Props

PropTypeRequiredDefaultDescription
sortBystringNo''Initial column to sort by.
order'asc' | 'desc'No'asc'Initial sort direction.
handleSortfunctionNo-Custom sort handler. Receives column name as parameter.

Pagination Props

PropTypeRequiredDefaultDescription
pagenumberNo1Current page number.
totalPagesnumberNo1Total number of pages.
pageSizenumberNo20Number of rows per page.
totalRowsnumberNo0Total number of rows across all pages.
handlePageChangefunctionNo-Custom page change handler. Receives page number as parameter.
handlePageSizeChangefunctionNo-Custom page size change handler. Receives event object.

Filtering Props

PropTypeRequiredDefaultDescription
filtersobjectNo{}Column filters in format { columnName: filterValue }.
applyFilterfunctionNo-Custom filter application handler. Receives column name and filter value.
clearFilterfunctionNo-Custom filter clearing handler. Receives column name.

Layout Props

PropTypeRequiredDefaultDescription
layoutOptionsobjectNo{}Layout configuration options.
layoutOptions.isStatsPanelOpenbooleanNofalseWhether the stats panel is initially open.
layoutOptions.maxHeightstring | numberNo'calc(100% - 115px)'Maximum height of the table body.
layoutOptions.stickyHeaderbooleanNotrueWhether the table header should stick to the top when scrolling.
layoutOptions.fullHeightbooleanNofalseWhether the table should take full available height.
layoutOptions.minHeightstring | numberNo-Minimum height of the table.
layoutOptions.responsiveBreakpointstringNo-Custom breakpoint for responsive behavior.

Hooks

useTableData

Hook to fetch and manage table data.

import { useTableData } from 'follow-table';

function MyComponent() {
  const {
    tableData,
    setTableData,
    sortBy,
    setSortBy,
    order,
    setOrder,
    page,
    setPage,
    pageSize,
    setPageSize,
    totalRows,
    setTotalRows,
    totalPages,
    setTotalPages,
    fetchData,
  } = useTableData(
    initialData,        // optional: initial data array
    databaseId,         // optional: database ID
    tableName,          // optional: table name
    externalSortBy,     // optional: controlled sort column
    externalOrder,      // optional: controlled sort direction
    externalPage,       // optional: controlled page number
    externalPageSize,   // optional: controlled page size
    externalTotalRows,  // optional: controlled total rows count
    externalTotalPages, // optional: controlled total pages count
    filters             // optional: column filters
  );
  
  // rest of your component...
}

useRowSelection

Hook to manage row selection.

import { useRowSelection } from 'follow-table';

function MyComponent() {
  const {
    selectedRows,         // Set of selected row IDs
    setSelectedRows,      // Function to manually set selected rows
    onRowSelect,          // Function to toggle selection of a single row
    isAllSelected,        // Boolean indicating if all rows are selected
    onToggleSelectAll,    // Function to toggle selection of all rows
  } = useRowSelection(tableData, idField);
  
  // rest of your component...
}

Individual Components

The library also exports individual components that can be used separately:

import { 
  TableHeader, 
  TableBody, 
  TableControls, 
  ViewModal, 
  StatsSidePanel 
} from 'follow-table';

Utility Functions

import { exportToCSV } from 'follow-table';

// Export data to CSV
exportToCSV(
  data,               // Data array to export
  columns,            // Columns to include
  'filename.csv',     // Optional filename
  {                   // Optional configuration
    delimiter: ',',
    includeHeaders: true,
    dateFormat: 'short',
    processCell: (value, column) => value
  }
);

Development

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

License

MIT

Keywords

react

FAQs

Package last updated on 30 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts