function / @typed/ui/Composite

rootTabIndex

Derives 0 when the root owns focus and -1 once a roving-focus item is active.

Learn this UI primitive →

Package version
1.0.0-beta.7
Category
Keyboard focus
Since
1.0.0

Import

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

Signatures

export declare function rootTabIndex<CompositeState extends State, E, R>(state: RefSubject.RefSubject<CompositeState, E, R>): RefSubject.Computed<0 | -1, E, R>;

Why

The operation exposes Composite’s transition directly so callers can compose it in Effect programs and native event handlers.

Ownership and lifetime

Creating the Computed value acquires nothing eagerly. The Scope that subscribes to it owns observation of the source RefSubject.

Example

Import with import { rootTabIndex } from "@typed/ui/Composite"; Extend the Composite.makeState runnable setup. Inside the linked Effect program read const value = yield* rootTabIndex(state); it is 0 while the root owns focus and -1 after a roving-focus item becomes active.

Other public imports

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

Source