Module / v1.0.0-beta.13

@typed/ui/Composite

27 unique exports available through this public import path, including their members and aliases.

Learn this UI primitive →

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

Active item state

  • ActiveIdState

    interface

    Public Composite.ActiveIdState behavioral model.

  • InitialState

    interface

    Initial Composite values. activeId defaults to null, orientation to horizontal, loop to true, RTL and virtual focus to false.

  • State

    interface

    Complete renderer-independent state for Composite.

  • StateSchema

    variable

    Effect Schema used by makeState to encode, decode, and hydrate Composite state.

  • makeState

    function

    Creates hydrated Composite state. activeId defaults to null, orientation to horizontal, loop to true, RTL and virtual focus to false.

DOM focus and scrolling

  • focusActive

    function

    Focuses the registered active element unless state uses virtual focus or has no active id.

  • focusElement

    function

    Calls an existing platform focus method inside Effect.sync and otherwise does nothing.

  • moveAndFocus

    function

    Moves active state, then focuses and scrolls the mounted active item when virtual focus is disabled.

  • scrollActive

    function

    Calls scrollIntoView with nearest block/inline alignment for the mounted active item.

Directional movement

  • Move

    type-alias

    Logical movement operations independent of physical key names.

  • MoveOptions

    interface

    State, collection, and disabled-item policy consumed by Composite movement helpers.

  • Orientation

    type-alias

    Supported composite movement axes.

  • move

    function

    Computes the next active id and updates state; collection and state failures/services are preserved in the returned Effect.

  • moveActiveId

    function

    Returns the id reached by first/last/next/previous with optional disabled inclusion and loop policy.

  • moveActiveItem

    function

    Returns the full item selected by moveActiveId, or undefined when no item is reachable.

  • orderedEnabledItems

    function

    Sorts a copy by mounted DOM order and then removes disabled items.

Keyboard focus

  • activeDescendant

    function

    Derives activeId only under virtual focus, otherwise undefined.

  • rootTabIndex

    function

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

  • tabIndex

    function

    Derives 0 only for the active item under roving focus; virtual-focus items always receive -1.

Keyboard navigation

  • KeyboardEventLike

    interface

    Public Composite.KeyboardEventLike behavioral model.

  • keyMove

    function

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

  • moveByKey

    function

    Prevents the native key default only when keyMove recognizes the key, then updates active state.

Typeahead

  • TypeaheadBuffer

    interface

    Public Composite.TypeaheadBuffer behavioral model.

  • typeahead

    function

    Returns the first enabled item id in DOM order whose textValue starts with the query.

  • typeaheadFrom

    function

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

  • typeaheadKey

    function

    Returns an unmodified one-character key exactly as provided; modified and multi-character keys return null.

  • updateTypeaheadBuffer

    function

    Appends within the timeout window and starts a new query after the buffer expires.