Type Editor / @type-editor/tables / input/arrow / arrow
Function: arrow()
ts
function arrow(axis, dir): Command;Defined in: tables/src/input/arrow.ts:30
Creates a command for arrow key navigation within tables.
When the cursor is within a cell selection, this moves the selection near the head cell. When at the edge of a cell, it navigates to the adjacent cell.
Parameters
| Parameter | Type | Description |
|---|---|---|
axis | Axis | The axis of movement ('horiz' for left/right, 'vert' for up/down). |
dir | Direction | The direction of movement (-1 for left/up, 1 for right/down). |
Returns
Command
A ProseMirror command that handles arrow key navigation.
Example
typescript
// Create a command for moving right
const moveRight = arrow("horiz", 1);