Skip to main content

Keyboard Navigation

OGrid supports comprehensive keyboard navigation for moving between cells, editing values, selecting ranges, and performing clipboard and undo operations -- all without touching the mouse.

Live Demo

Click a cell, then use Arrow keys, Tab, Enter, or F2
Live
Name
Department
Status
Salary
Alice Johnson
Engineering
Active
$50,000
Bob Smith
Marketing
Draft
$53,500
Carol Lee
Sales
Archived
$57,000
David Kim
Finance
Active
$60,500
Eve Torres
Operations
Draft
$64,000
Frank Wu
Engineering
Archived
$67,500
Grace Park
Marketing
Active
$71,000
Henry Adams
Sales
Draft
$74,500
Irene Costa
Finance
Archived
$78,000
Jack Rivera
Operations
Active
$81,500
Try it in your framework

The demo above uses Radix UI for styling. To see this feature with your framework's design system (Fluent UI, Material UI, Vuetify, PrimeNG, etc.), click "Open in online demo" below the demo.

Quick Example

import { OGrid } from '@alaarab/ogrid-react-radix';

function App() {
return (
<OGrid
columns={columns}
data={data}
getRowId={(r) => r.id}
editable
/>
);
}
Switching UI libraries

The OGrid component has the same props across all React UI packages. To switch, just change the import:

  • Radix (lightweight, default): from '@alaarab/ogrid-react-radix'
  • Fluent UI (Microsoft 365 / SPFx): from '@alaarab/ogrid-react-fluent' — wrap in <FluentProvider>
  • Material UI (MUI v7): from '@alaarab/ogrid-react-material' — wrap in <ThemeProvider>

Click any cell to make it the active cell, then use the keyboard to navigate and edit.

KeyAction
Arrow Up / Down / Left / RightMove active cell in that direction
Ctrl+ArrowJump to the edge of the current data region (Excel-style)
TabMove to the next cell (left to right, then next row)
Shift+TabMove to the previous cell
HomeMove to the first column in the current row
EndMove to the last column in the current row
Ctrl+HomeMove to the first cell in the grid (top-left)
Ctrl+EndMove to the last cell in the grid (bottom-right)
Page DownMove down by one page of rows
Page UpMove up by one page of rows

Cell Selection

KeyAction
ClickSet active cell
Shift+ArrowExtend selection range from the active cell
Ctrl+Shift+ArrowExtend selection to the edge of the current data region
Shift+ClickSelect range from active cell to clicked cell
Ctrl+ASelect all cells in the grid (for copy/paste/fill operations, not row selection)

The selection range is highlighted with a green border. The active cell remains visually distinct within the range.

Cell Selection vs Row Selection

Ctrl+A selects all cells in the grid for spreadsheet operations (copy/paste/fill). This is different from row selection, where the header checkbox selects all rows for bulk operations. See Row Selection and Spreadsheet Selection for details.

Ctrl+Arrow (Data Region Jump)

Ctrl+Arrow navigates the same way Excel does:

  • Non-empty cell → non-empty neighbor: Jumps to the last non-empty cell before a gap (empty cell) or the grid edge.
  • Non-empty cell → empty neighbor: Skips over the empty cells and lands on the next non-empty cell, or the grid edge if all remaining cells are empty.
  • Empty cell: Jumps to the next non-empty cell in that direction, or the grid edge.

Combine with Shift to extend the selection range to the same target.

Editing

KeyAction
EnterStart editing the active cell; press again to commit and move down
F2Start editing the active cell (cursor at end of text)
EscapeCancel editing and revert to the original value
Delete / BackspaceClear the contents of selected cells
Any printable characterStart editing and replace cell content with the typed character

When a cell is in edit mode:

  • Enter commits the value and moves the active cell down.
  • Tab commits the value and moves the active cell right.
  • Escape discards the edit and returns to navigation mode.
  • Arrow keys move the cursor within the editor (they do not navigate between cells while editing).

Clipboard

KeyAction
Ctrl+CCopy selected cells to clipboard (tab-separated)
Ctrl+XCut selected cells (copy + clear originals)
Ctrl+VPaste clipboard contents starting at the active cell

Copied data uses tab-separated format compatible with Excel and Google Sheets. Multi-cell selections copy the entire rectangular range.

Undo / Redo

KeyAction
Ctrl+ZUndo the last cell edit
Ctrl+YRedo the last undone edit

Undo/redo requires the onUndo, onRedo, canUndo, and canRedo props to be wired up (typically via the useUndoRedo hook).

How It Works

Keyboard navigation is handled by the useKeyboardNavigation hook in core, which is automatically wired into the grid when cellSelection is enabled (the default). The hook listens for keydown events on the grid wrapper element and translates them into active cell movements, selection range changes, or editing actions.

Disabling Cell Selection

Set cellSelection={false} to disable keyboard-driven cell navigation, selection, clipboard, and context menu. The grid becomes a read-only display table.

<OGrid
columns={columns}
data={data}
getRowId={(r) => r.id}
cellSelection={false}
/>

macOS

On macOS, Ctrl is replaced by the Command key for all shortcuts (Cmd+C, Cmd+V, Cmd+Z, etc.). The grid detects the platform automatically.

Props Reference

TypeFieldDescription
IOGridProps<T>cellSelectionboolean -- enable/disable keyboard navigation and selection (default true)
IOGridProps<T>editableboolean -- enable cell editing via keyboard
IOGridProps<T>onUndoCallback for Ctrl+Z
IOGridProps<T>onRedoCallback for Ctrl+Y
IOGridProps<T>canUndoboolean -- whether undo is available
IOGridProps<T>canRedoboolean -- whether redo is available
  • Context Menu -- right-click menu mirrors keyboard shortcuts
  • Status Bar -- shows aggregations for keyboard-selected ranges
  • Column Pinning -- navigation works seamlessly across pinned and scrollable columns