@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    A hierarchical tree-view component driven by an ITreeDatasource.

    Supports expand/collapse, single/multiple selection, keyboard navigation (arrows, Enter, Space), ARIA tree pattern, and optional custom node templates via content projection.

    <ui-tree-view [datasource]="ds" [displayWith]="nodeLabel" />
    
    <ui-tree-view [datasource]="ds">
    <ng-template #nodeTemplate let-node>
    <ui-icon [svg]="node.icon" [size]="16" />
    <span>{{ node.data.name }}</span>
    </ng-template>
    </ui-tree-view>

    Type Parameters

    • T = unknown

    Implements

    Index

    Constructors

    Properties

    ariaLabel: InputSignal<string> = ...

    Accessible label for the tree.

    datasource: InputSignal<ITreeDatasource<T>> = ...

    The datasource providing the tree structure.

    disabled: InputSignal<boolean> = ...

    Whether the tree view is disabled.

    displayWith: InputSignal<(data: T) => string> = ...

    Function that returns a display string for a node's data. Used when no custom #nodeTemplate is projected. Defaults to String(node.data).

    filterPredicate: InputSignal<Predicate<T> | null | undefined> = ...

    Optional predicate applied to each node's data payload.

    When set, only nodes that satisfy the predicate (or whose descendants satisfy it) are rendered. Ancestor nodes of matching descendants are kept visible and auto-expanded so the user can see the full path.

    Pass undefined or null to clear the filter.

    nodeActivated: OutputEmitterRef<TreeNode<T>> = ...

    Emits when a node is activated (double-click or Enter on selected node).

    nodeCollapsed: OutputEmitterRef<TreeNode<T>> = ...

    Emits the node when a node is collapsed.

    nodeExpanded: OutputEmitterRef<TreeNode<T>> = ...

    Emits the node when a node is expanded.

    nodeTemplate: Signal<TemplateRef<TreeNodeContext<T>> | undefined> = ...

    Optional consumer-projected template for rendering each node's content. Receives TreeNodeContext as its context.

    selected: ModelSignal<readonly TreeNode<T>[]> = ...

    The currently selected node(s). Two-way bindable via [(selected)].

    • Arrow keys replace the selection with the cursor node.
    • Shift + arrows extend the selection.
    • Ctrl / ⌘ + click toggles individual nodes.
    • Escape clears the selection.
    sortComparator: InputSignal<
        ((a: TreeNode<T>, b: TreeNode<T>) => number)
        | null
        | undefined,
    > = ...

    Optional comparator for sorting tree nodes at all levels.

    When set, nodes are sorted at the root level and all descendants are recursively sorted using this comparator. The comparator receives two TreeNode values and should return a negative, zero, or positive number indicating their sort order.

    Pass undefined or null to clear the sort and restore insertion order.

    sortComparator: (a, b) => a.data.name.localeCompare(b.data.name)
    

    Methods

    • Collapses the given node.

      Parameters

      Returns void

    • Collapses all nodes in the tree.

      Returns void

    • Expands the given node.

      Parameters

      Returns void

    • Expands all nodes in the tree recursively.

      Returns void

    • Returns whether the given node is currently expanded.

      Parameters

      Returns boolean

    • Returns whether the given node is currently selected.

      Parameters

      Returns boolean

    • Selects the given node, replacing any existing selection.

      Parameters

      Returns void

    • Toggles the expanded state of the given node.

      Parameters

      Returns void