nodes supplies flat records with stable keys and data; hierarchy describes roots and loaded/unloaded child relations. Apply expandedKeysChange.keys to expandedKeys and selectionChange.selection to selection. childrenRequest identifies an unloaded parent and request; the application loads children and replaces nodes/hierarchy. nodeMove is a proposal: update hierarchy to accept it. A Template receives node data, not the wrapper node.
These inputs require a model or function, not a checkbox. Edit the same-named field in the Source component and bind it in the template; data already used by this preview appears in the state above.
nodes supplies flat records with stable keys and data; hierarchy describes roots and loaded/unloaded child relations. Apply expandedKeysChange.keys to expandedKeys and selectionChange.selection to selection. childrenRequest identifies an unloaded parent and request; the application loads children and replaces nodes/hierarchy. nodeMove is a proposal: update hierarchy to accept it. A Template receives node data, not the wrapper node.
Arrow keys traverse and expand/collapse nodes; Home/End reach the first/last visible node. Space changes selection. Reordering has keyboard alternatives when enabled.
Key
Action
Tab
Reach the tree and its enabled controls.
ArrowDown / ArrowUp
Focus the next or previous visible node.
ArrowRight / ArrowLeft
Expand, enter, collapse or leave a branch; horizontal direction follows RTL.
Home
Focus the first visible node.
End
Focus the last visible node.
Enter
Activate selection for the focused node when selection is enabled.
Space
Activate selection for the focused node when selection is enabled.
Inputs, models and Outputs are extracted from the installed Core package. Named public types link to their definitions. Templates below include executable examples.
Inputs
Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.
Name
Type
Default
Template binding
Description
ariaLabel
string
'Tree'
[ariaLabel]
Accessible name of the tree.
collapseLabel
string
'Collapse node'
[collapseLabel]
Accessible label of the toggle in expanded mode.
emptyLabel
string
'No nodes available'
[emptyLabel]
Label for empty collection. Translate it for your application.
expandedKeys
readonly K[]
[]
[expandedKeys]
Applied keys of expanded branches. Expansion changes are proposed to the application.
Proposes selection together with the affected key and interaction source. Apply payload.selection to selection.
Templates
ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.
import type { NeuTreeKey } from '@neural-ui/core/tree';
import { NeuTreeNodeDirective } from '@neural-ui/core/tree';
// Public declaration (reference only)
export declare class NeuTreeNodeDirective<T, K extends NeuTreeKey = string> {
}
context.d.ts
import type { NeuTreeNodeTemplateContext } from '@neural-ui/core/tree';
import { NeuTreeNodeDirective } from '@neural-ui/core/tree';
// Public declaration (reference only)
readonly templateRef: TemplateRef<NeuTreeNodeTemplateContext<T, K>>;
Each example demonstrates a different template. Switch between Demo and Code to inspect its implementation, imports and state.
NeuTreeNodeDirective
NeuTreeNodeDirective
NeuTreeNodeDirective
WorkspaceLevel 1 ยท โ
DesignLevel 2 ยท โ
EngineeringLevel 2 ยท โ
ArchiveLevel 1 ยท โ
Events: 0
Public Types
Open a type to inspect its definition and interface fields.
import type { NeuTreeKey } from '@neural-ui/core/tree';
import type { NeuTreeChildrenRequest } from '@neural-ui/core/tree';
// Public declaration (reference only)
export interface NeuTreeChildrenRequest<K extends NeuTreeKey> {
readonly hierarchyRevision: number;
readonly parentKey: K;
readonly reason: 'expand' | 'retry';
readonly requestId: number;
}
NeuTreeExpandedKeysChange.d.ts
import type { NeuTreeInteractionSource } from '@neural-ui/core/tree';
import type { NeuTreeKey } from '@neural-ui/core/tree';
import type { NeuTreeExpandedKeysChange } from '@neural-ui/core/tree';
// Public declaration (reference only)
export interface NeuTreeExpandedKeysChange<K extends NeuTreeKey> {
readonly expanded: boolean;
readonly key: K;
readonly keys: readonly K[];
readonly source: NeuTreeInteractionSource;
}
NeuTreeHierarchy.d.ts
import type { NeuTreeChildrenRelation } from '@neural-ui/core/tree';
import type { NeuTreeKey } from '@neural-ui/core/tree';
import type { NeuTreeHierarchy } from '@neural-ui/core/tree';
// Public declaration (reference only)
export interface NeuTreeHierarchy<K extends NeuTreeKey> {
readonly children: readonly NeuTreeChildrenRelation<K>[];
readonly revision: number;
readonly roots: readonly K[];
}
NeuTreeInteractionSource.d.ts
import type { NeuTreeInteractionSource } from '@neural-ui/core/tree';
// Public declaration (reference only)
export type NeuTreeInteractionSource = 'pointer' | 'keyboard';
NeuTreeKey.d.ts
import type { NeuTreeKey } from '@neural-ui/core/tree';
// Public declaration (reference only)
export type NeuTreeKey = string | number;
NeuTreeMovePosition.d.ts
import type { NeuTreeMovePosition } from '@neural-ui/core/tree';
// Public declaration (reference only)
export type NeuTreeMovePosition = 'before' | 'inside' | 'after';
NeuTreeNode.d.ts
import type { NeuTreeKey } from '@neural-ui/core/tree';
import type { NeuTreeNode } from '@neural-ui/core/tree';
// Public declaration (reference only)
export interface NeuTreeNode<T, K extends NeuTreeKey = string> {
readonly badge?: string;
readonly data: T;
readonly description?: string;
readonly disabled?: boolean;
readonly key: K;
readonly label: string;
}
NeuTreeNodeAction.d.ts
import type { NeuTreeKey } from '@neural-ui/core/tree';
import type { NeuTreeNodeAction } from '@neural-ui/core/tree';
// Public declaration (reference only)
export interface NeuTreeNodeAction<K extends NeuTreeKey> {
readonly key: K;
}
NeuTreeNodeMove.d.ts
import type { NeuTreeKey } from '@neural-ui/core/tree';
import type { NeuTreeMovePosition } from '@neural-ui/core/tree';
import type { NeuTreeNodeMove } from '@neural-ui/core/tree';
// Public declaration (reference only)
export interface NeuTreeNodeMove<K extends NeuTreeKey> {
readonly position: NeuTreeMovePosition;
readonly sourceIndex: number;
readonly sourceKey: K;
readonly sourceParentKey: K | null;
readonly targetIndex: number;
readonly targetKey: K;
readonly targetParentKey: K | null;
}
NeuTreeNodeTemplateContext.d.ts
import type { NeuTreeKey } from '@neural-ui/core/tree';
import type { NeuTreeNodeTemplateContext } from '@neural-ui/core/tree';
// Public declaration (reference only)
export interface NeuTreeNodeTemplateContext<T, K extends NeuTreeKey = string> {
readonly $implicit: T;
readonly disabled: boolean;
readonly expanded: boolean;
readonly hasChildren: boolean;
readonly key: K;
readonly level: number;
readonly loading: boolean;
readonly partial: boolean;
readonly selected: boolean;
}
NeuTreeSelection.d.ts
import type { NeuTreeKey } from '@neural-ui/core/tree';
import type { NeuTreeSelection } from '@neural-ui/core/tree';
// Public declaration (reference only)
export type NeuTreeSelection<K extends NeuTreeKey> = {
readonly mode: 'none';
} | {
readonly mode: 'single';
readonly key: K | null;
} | {
readonly mode: 'multiple';
readonly keys: readonly K[];
} | {
readonly mode: 'checkbox';
readonly keys: readonly K[];
};
NeuTreeSelectionChange.d.ts
import type { NeuTreeInteractionSource } from '@neural-ui/core/tree';
import type { NeuTreeKey } from '@neural-ui/core/tree';
import type { NeuTreeSelection } from '@neural-ui/core/tree';
import type { NeuTreeSelectionChange } from '@neural-ui/core/tree';
// Public declaration (reference only)
export interface NeuTreeSelectionChange<K extends NeuTreeKey> {
readonly key: K;
readonly selection: NeuTreeSelection<K>;
readonly source: NeuTreeInteractionSource;
}
NeuTreeVirtualization.d.ts
import type { NeuTreeVirtualization } from '@neural-ui/core/tree';
// Public declaration (reference only)
export interface NeuTreeVirtualization {
readonly buffer?: number;
readonly itemSize: number;
readonly viewportHeight: number;
}
Use the supported public tokens listed below. Surrounding layout belongs to your application; validate the result in light and dark modes and narrow containers.
Specific tokens
This component uses shared theme tokens rather than dedicated component hooks.
Shared tokens used
Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.
Token
Purpose here
Other impact
Default / fallback
--neu-border
Normal control and cell borders
Shared by other Core consumers; scope the override.
rgba(15, 23, 42, 0.08)
--neu-focus-ring
Normal keyboard-focus ring
Shared by other Core consumers; scope the override.