g3-toolkit API Reference
    Preparing search index...

    Interface TreeViewProps

    interface TreeViewProps {
        ariaLabel?: string;
        className?: string;
        density?: "comfortable" | "compact";
        filter?: string | ((node: TreeRowNode) => boolean);
        initialDepth?: number;
        initialExpanded?: string[];
        isGroup?: (node: TreeRowNode) => boolean;
        onSelect?: (id: string) => void;
        renderLabel?: (node: TreeRowNode, ctx: TreeLabelContext) => ReactNode;
        rootId?: string;
        rootIds?: string[];
        selected?: string | null;
        showBreadcrumb?: boolean;
        showType?: boolean;
        ugm: UGM;
        workingSetManager?: WorkingSetManager;
    }
    Index

    Properties

    ariaLabel?: string

    Accessible name of the tree (#59). Default "Hierarchy".

    className?: string
    density?: "comfortable" | "compact"

    Row density (B3): "comfortable" (default) or "compact".

    filter?: string | ((node: TreeRowNode) => boolean)

    Keep only the rows that match plus their ancestors (#59). A string is a case-insensitive substring test on the label; a predicate sees the row. Ancestors of a match are HELD open while the filter is active (a filter is a result view, so their chevron is inert and ArrowLeft climbs instead of closing); clearing it restores the expansion the user had. Empty string or undefined: no filter.

    initialDepth?: number

    Levels open on first render (default 2). This SEEDS the expanded set; every row, seeded or not, toggles afterwards. The seed is recomputed when the graph, the roots or this value change, and user toggles survive that reseed: a row the user closed stays closed, a row the user opened stays open, and rows new to the graph open or close by depth as on a first render.

    initialExpanded?: string[]

    Ids open on first render in addition to initialDepth (#59): every row carrying a listed id. The same seed semantics: recomputed on change, toggles survive. The branch holding the selection present at mount is seeded open too, and a selection that later arrives from outside (the store or selected) opens the branch of every copy and scrolls the first into view.

    isGroup?: (node: TreeRowNode) => boolean

    Mark a row as an expand-only group (#59): "Object properties" over its members. Click, Enter and Space toggle it instead of selecting, it carries no aria-selected, and data-group="true" for host CSS. A predicate rather than a reserved node property because the UGM data model is the adapter's, and a host's group rows are usually synthetic nodes it injected itself (by type, id prefix or a property only it knows), so it should decide.

    onSelect?: (id: string) => void

    Fires with the id when the user picks a row (click, Enter, Space, a breadcrumb). Uncontrolled it accompanies the store write; controlled (selected given) it is the only channel.

    renderLabel?: (node: TreeRowNode, ctx: TreeLabelContext) => ReactNode

    Replace the label text (#59): a count with a tooltip, a tag, a muted or italic row. The [type] prefix and the chevron stay in place around it. Absent, the label renders as plain text.

    rootId?: string

    Root node ID for the tree. If omitted (and rootIds is not given), auto-detects the first node with no incoming edge.

    rootIds?: string[]

    Several roots, rendered as a forest with no synthetic parent row (issue #36: an ontology's classes under owl:Thing plus reused superclasses such as prov:Entity as further roots). Takes precedence over rootId when non-empty. A declared root is pinned to the top level: if it is also reachable from another root it is NOT repeated as that root's descendant. Any other node reachable from several parents renders under each (#59). Hold the array in a useMemo: a fresh literal each render rebuilds the tree each render (same contract as fixture graphs).

    selected?: string | null

    Controlled selection (#59). Given (a string or null), the tree highlights that id and neither reads nor writes the shared useSelectionStore: a URL-driven rail no longer collides with the canvas or table on the same page. Omitted, the tree reads and writes the store as before. Switching between the two after mount is not supported.

    showBreadcrumb?: boolean

    Upstream P3 (prm-analyzer, 2026-07-28): render the breadcrumb trail. Default true.

    showType?: boolean

    Print the [type] prefix before each label (default true, the historical output). Turn off when every row shares one type and the prefix is noise.

    ugm: UGM
    workingSetManager?: WorkingSetManager

    Working-set manager for limit enforcement. Wins over the nearest WorkingSetProvider; absent both, the module default applies.