Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

gigatable

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gigatable

Excel-like datatable for React — add it to your codebase with npx gigatable init

latest
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

gigatable-cli

Documentation: gigatable.aiken.si

Gigatable is supported by Preskok ThinkTank.

Preskok Think Tank

Excel-like datatable for React with cell selection, range selection, inline editing, copy/paste, fill handle, column resizing, and undo/redo — powered by TanStack Table and TanStack Virtual.

Install: npx gigatable init copies the source files directly into your project. You own the code.

Requirements

  • React 19+
  • TypeScript
  • Tailwind CSS v4
  • Node 18+

Install

npx gigatable init

This will:

  • Prompt for a target directory (default: src/gigatable)
  • Check for TypeScript and Tailwind CSS v4
  • Copy all component files into your project
  • Install peer dependencies: @tanstack/react-table, @tanstack/react-virtual, clsx

Quick Start

// app.tsx
import { Gigatable, useGigatable } from "./gigatable";
import { columns } from "./columns";
import { myData } from "./data";

export function App() {
  const { table, paste, applyFill, undo, redo } = useGigatable({
    columns,
    data: myData,
    enableColumnResizing: true,
    columnResizeMode: "onChange",
    history: true,
  });

  return (
    <Gigatable
      table={table}
      allowCellSelection
      allowRangeSelection
      allowHistory
      allowPaste
      allowFillHandle
      allowColumnResizing
      paste={paste}
      applyFill={applyFill}
      undo={undo}
      redo={redo}
    />
  );
}

Column Definitions

Use TanStack Table's ColumnDef format. Mark editable columns with meta: { editable: true } and wrap the cell with <EditableCell>.

// columns.tsx
import { ColumnDef } from "@tanstack/react-table";
import { EditableCell, EditableCellInputProps } from "./gigatable";

const TextInput = ({
  value,
  onChange,
  onKeyDown,
  onBlur,
}: EditableCellInputProps<string>) => (
  <input
    autoFocus
    value={value as string}
    onChange={onChange}
    onKeyDown={onKeyDown}
    onBlur={onBlur}
  />
);

const NumberInput =
  (step = 1) =>
  ({ value, onChange, onKeyDown, onBlur }: EditableCellInputProps<number>) =>
    (
      <input
        autoFocus
        type="number"
        step={step}
        value={value as number}
        onChange={onChange}
        onKeyDown={onKeyDown}
        onBlur={onBlur}
      />
    );

export const columns: ColumnDef<MyRow, unknown>[] = [
  {
    accessorKey: "id",
    header: "ID",
    size: 80,
    // no meta.editable — read-only
  },
  {
    accessorKey: "name",
    header: "Name",
    size: 200,
    cell: (cell) => <EditableCell {...cell} renderInput={TextInput} />,
    meta: { editable: true },
  },
  {
    accessorKey: "score",
    header: "Score",
    size: 100,
    cell: (cell) => <EditableCell {...cell} renderInput={NumberInput(0.1)} />,
    meta: { editable: true },
  },
];

TypeScript Setup

Add the type augmentation file to your tsconfig.json:

{
  "include": ["src", "src/gigatable/types/react-table.ts"]
}

This enables the meta: { editable: true } property on column definitions without type errors.

API Reference

useGigatable(options)

Wraps TanStack Table's useReactTable. Accepts all standard TableOptions<TData> except getCoreRowModel (added automatically).

OptionTypeDefaultDescription
columnsColumnDef<TData, TValue>[]requiredTanStack column definitions
dataTData[]requiredRow data. Synced to internal state when the array reference changes.
historybooleanfalseEnable undo/redo tracking
maxHistorySizenumber20Max undo steps retained
enableColumnResizingbooleanTanStack defaultEnable TanStack column resizing state and handlers
columnResizeMode"onChange" or "onEnd"TanStack defaultUse "onChange" for live width updates while dragging

Returns: { table, paste, applyFill, undo, redo, clear, canUndo, canRedo }

<Gigatable>

PropTypeDefaultDescription
tableTable<TData>requiredInstance from useGigatable
allowCellSelectionbooleanfalseClick selection + arrow key navigation
allowRangeSelectionbooleanfalseDrag + Shift+Arrow range. Requires allowCellSelection.
singleColumnCellSelectionbooleanfalseDrag + Shift+Arrow range down one column. Requires allowCellSelection; works when allowRangeSelection is false.
allowHistorybooleanfalseCtrl/Cmd+Z / Ctrl/Cmd+Shift+Z. Requires undo + redo.
allowPastebooleanfalseCtrl/Cmd+V paste (TSV). Requires paste.
allowFillHandlebooleanfalseDrag-fill down. Requires applyFill + meta: { editable: true } columns.
allowColumnResizingbooleanfalseHeader-border drag resizing. Requires enableColumnResizing in useGigatable.
pasteFunctionFrom useGigatable. Required when allowPaste.
applyFillFunctionFrom useGigatable. Required when allowFillHandle.
undo() => voidFrom useGigatable. Required when allowHistory.
redo() => voidFrom useGigatable. Required when allowHistory.
allColumnsEditablebooleanfalseMake every column editable with a default text input. Columns with meta: { editable: true } keep their own renderInput.
onPasteComplete(result: PasteResult) => voidCalled after each paste with change details.
themeGigatableThemethemes.lightCustomise visual appearance.

<EditableCell>

Renders a cell in either view mode (double-click/Enter to edit) or edit mode. Accepts all TanStack CellContext<TData, TValue> props plus:

PropTypeDescription
renderInputFC<EditableCellInputProps<TValue>>Your custom input component

EditableCellInputProps<TValue>

Props passed to your renderInput component:

PropDescription
valueCurrent cell value
onChangeStandard input change handler
onBlurCommits value and exits edit mode
onValueChangeCommit a value string directly (for custom/select inputs)
onKeyDownForward to handle Tab (save + move), Enter (save), Escape (cancel)
cancelEditingDiscard changes and return to view mode
classNameOptional className for the input element

PasteResult

Returned by paste() and passed to onPasteComplete:

interface PasteResult {
  changes: CellChange[];
  totalChanges: number;
}

interface CellChange {
  rowIndex: number;
  rowId: string;
  columnId: string;
  columnHeader: string;
  oldValue: unknown;
  newValue: unknown;
}

Keyboard Shortcuts

ShortcutAction
ClickSelect cell
Shift+Click / DragExtend range selection
Arrow keysMove selection
Shift+ArrowExtend range
Ctrl/Cmd+Home/EndJump to first/last row
EnterEnter edit mode
Double-clickEnter edit mode
TabSave + move to next cell
EscapeCancel edit
Ctrl/Cmd+CCopy selection to clipboard (TSV)
Ctrl/Cmd+VPaste from clipboard
Ctrl/Cmd+ZUndo
Ctrl/Cmd+Shift+ZRedo
Drag header borderResize column
Double-click header borderReset column width

Column Resizing

Column resizing is opt-in at both the TanStack state layer and the Gigatable render layer:

const { table } = useGigatable({
  columns,
  data,
  enableColumnResizing: true,
  columnResizeMode: "onChange",
});

<Gigatable table={table} allowColumnResizing />;

Persist widths by controlling TanStack sizing state:

const [columnSizing, setColumnSizing] = useState({});

const { table } = useGigatable({
  columns,
  data,
  enableColumnResizing: true,
  columnResizeMode: "onChange",
  state: { columnSizing },
  onColumnSizingChange: setColumnSizing,
});

Theming

Three built-in presets are available. Pass one as the theme prop, or spread and override individual fields.

import { themes, Gigatable } from "./gigatable";

// Use a preset
<Gigatable theme={themes.dark} ... />

// Customize on top of a preset
<Gigatable theme={{ ...themes.dark, header: { background: "var(--brand)" } }} ... />

// Partial custom theme — unset fields fall back to themes.light
<Gigatable theme={{ row: { height: 36 }, selection: { outline: "orange" } }} ... />

The GigatableTheme interface groups fields by visual area:

import type { GigatableTheme } from "./gigatable";

const myTheme: GigatableTheme = {
  header: { background: "#1e293b", textColor: "#f8fafc", height: 40 },
  row: { height: 32, background: "#ffffff", hoverBackground: "#f1f5f9" },
  cell: { borderColor: "#e2e8f0", fontSize: 13, paddingX: 12, paddingY: 6 },
  selection: { outline: "var(--primary)", rangeBackground: "rgba(59,130,246,0.1)" },
  paste: { highlightBackground: "rgba(134,239,172,0.25)" },
  fill: { previewBackground: "#eff4ff", previewTextColor: "#6b8ccd" },
};

All values accept strings (including CSS variable references like "var(--primary)") or numbers (treated as px).

Known Limitations

  • Tailwind CSS v4 required — all styling uses Tailwind utility classes.
  • TypeScript only — JavaScript projects are not supported.
  • Fill handle fills up/down only — not left, or right.
  • Paste format: TSV — compatible with Excel and Google Sheets. JSON or CSV paste is not supported.
  • React 19+ — older React versions are untested.

FAQs

Package last updated on 18 May 2026

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