function / @typed/ui

Composite.typeaheadFrom

Returns only the id selected by typeahead, or null when no item matches.

Learn this UI primitive →

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

Import

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

Access Composite.typeaheadFrom 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 declare function typeaheadFrom<Item extends Collection.Item<unknown, object>>(items: readonly Item[], search: string, activeId: string | null, text?: (item: Item) => string, includeDisabled?: boolean): string | null;

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 id = Composite.typeaheadFrom([{ id: "alpha", textValue: "Alpha" }], "al", null);

Other public imports

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

Source