Skip to content

Keyboard Shortcuts

SciGrid comes with a full set of keyboard shortcuts for desktop-class navigation. Every shortcut is configurable — you can override defaults, disable shortcuts, or define your own custom actions.

Default Shortcuts

ActionDefault KeyDescription
copyCtrl+CCopy selected cells to clipboard
pasteCtrl+VPaste tabular data from clipboard
undoCtrl+ZUndo last edit/paste/delete
redoCtrl+YRedo last undone action
selectAllCtrl+ASelect all cells
editF2Open cell editor on current cell
deleteDeleteClear selected cells
moveUpMove selection up one row
moveDownMove selection down one row
moveLeftMove selection left one column
moveRightMove selection right one column
pageUpPage UpMove selection up one page
pageDownPage DownMove selection down one page
moveToStartHomeMove to first column (Ctrl+Home = first cell)
moveToEndEndMove to last column (Ctrl+End = last cell)
contextMenuShift+F10Open context menu at current cell

All navigation shortcuts support Shift for extending the selection range.

Accessing Defaults Programmatically

The DEFAULT_SHORTCUTS object is exported so you can inspect or display the current defaults:

typescript
import { DEFAULT_SHORTCUTS } from '@sci-grid/core';

// Show all default shortcuts
console.log(DEFAULT_SHORTCUTS);
// { copy: { key: 'c', ctrl: true }, paste: { key: 'v', ctrl: true }, ... }

Overriding Shortcuts

Pass keyboardShortcuts in the grid config to override any default:

typescript
const grid = new SciGrid(container, provider, {
  keyboardShortcuts: {
    // Change copy to Ctrl+Shift+C
    copy: { key: 'c', ctrl: true, shift: true },

    // Disable select-all
    selectAll: null,

    // Change context menu to F2
    contextMenu: { key: 'F2' },
  }
});

KeyboardShortcut Interface

typescript
interface KeyboardShortcut {
    key: string;      // The key name (e.g. 'c', 'ArrowUp', 'F10', 'Delete')
    ctrl?: boolean;   // Require Ctrl (or Cmd on macOS)
    shift?: boolean;  // Require Shift
    alt?: boolean;    // Require Alt
    meta?: boolean;   // Require Meta (Windows key / Cmd)
}

Custom Shortcuts

You can define your own shortcut actions beyond the built-in ones. Custom actions are dispatched via the onShortcut callback:

typescript
const grid = new SciGrid(container, provider, {
  keyboardShortcuts: {
    // Custom actions — any string key that isn't a built-in action
    deleteRow: { key: 'Delete' },
    insertRow: { key: 'Insert' },
    toggleFilter: { key: 'f', ctrl: true },
    exportData: { key: 's', ctrl: true },
  },

  onShortcut: (action, event) => {
    switch (action) {
      case 'deleteRow':
        deleteSelectedRows();
        break;
      case 'insertRow':
        insertRowAtCursor();
        break;
      case 'toggleFilter':
        toggleFilterPanel();
        break;
      case 'exportData':
        exportToCSV();
        break;
    }
  }
});

Disabling All Shortcuts

To disable all keyboard shortcuts, set each one to null:

typescript
const grid = new SciGrid(container, provider, {
  keyboardShortcuts: {
    copy: null,
    selectAll: null,
    moveUp: null,
    moveDown: null,
    moveLeft: null,
    moveRight: null,
    pageUp: null,
    pageDown: null,
    moveToStart: null,
    moveToEnd: null,
    contextMenu: null,
  }
});

React Example

tsx
import { SciGridReact } from '@sci-grid/react';

function DataGrid({ data }) {
  return (
    <SciGridReact
      provider={provider}
      config={{
        keyboardShortcuts: {
          exportData: { key: 's', ctrl: true },
        },
      }}
      onShortcut={(action) => {
        if (action === 'exportData') downloadCSV(data);
      }}
    />
  );
}

Integrated under the Sci DNA / VeloSci Ecosystem