function / @typed/ui/Composite

keyMove

Maps Home/End and orientation-aware Arrow keys to movement, reversing horizontal arrows for RTL.

Learn this UI primitive →

Package version
1.0.0-beta.13
Category
Keyboard navigation
Since
1.0.0

Import

import { keyMove } from "@typed/ui/Composite";

Signatures

export declare function keyMove(event: Pick<KeyboardEventLike, "key">, options: {
    readonly orientation?: Orientation;
    readonly rtl?: boolean;
}): Move | undefined;

Why

Separating this deterministic policy from event wiring lets applications test it directly and reuse it in custom composites.

Ownership and lifetime

This is a synchronous calculation. It acquires no resources and does not mutate the input array, state, event, or DOM.

Examples

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

const direction = Composite.keyMove({ key: "ArrowLeft" }, { orientation: "horizontal", rtl: true });

Other public imports

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

Source