function / @typed/ui/Grid

moveActiveId

Maps grid keys to a cell id: horizontal movement stays in-row, vertical movement stays in-column, and Ctrl+Home/End reaches grid endpoints.

Learn this UI primitive →

Package version
1.0.0-beta.7
Category
Spatial navigation
Since
1.0.0

Import

import { moveActiveId } from "@typed/ui/Grid";

Signatures

export declare function moveActiveId(items: readonly Collection.Item<CellPosition>[], activeId: string | null, event: Pick<KeyboardEvent, "key" | "ctrlKey">): string | undefined;

Examples

import * as Grid from "@typed/ui/Grid";

const nextId = Grid.moveActiveId([{ id: "a", value: { rowId: "r1", columnIndex: 1 } }], "a", { key: "ArrowRight", ctrlKey: false });

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source