interface / @typed/ui/index

Composite.KeyboardEventLike

Public Composite.KeyboardEventLike behavioral model.

Learn this UI primitive →

Package version
1.0.0-beta.7
Category
Keyboard navigation
Since
1.0.0
Member of
Composite

Import

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

Access Composite.KeyboardEventLike through the imported Composite export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export interface KeyboardEventLike {
    readonly key: string;
    readonly altKey?: boolean;
    readonly ctrlKey?: boolean;
    readonly metaKey?: boolean;
    preventDefault?: () => void;
}

Why

The public model lets custom composites reuse Composite’s deterministic policy without copying an internal shape.

Ownership and lifetime

This declaration is data or schema metadata and acquires no resources.

Example

Import with import type { KeyboardEventLike } from "@typed/ui/Composite"; Extend the Composite.makeState runnable setup. Custom keyboard adapters need only the modeled surface: const event: KeyboardEventLike = { key: "ArrowDown", preventDefault() {} }.

Property: altKey

Whether Alt modified the key event.

Property: ctrlKey

Whether Control modified the key event.

Property: key

Native KeyboardEvent key value to interpret.

Property: metaKey

Whether Meta modified the key event.

Property: preventDefault

Optional native-event callback invoked only for an internally handled key.

Other public imports

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

Source