the interface from useFoldControls, which allows you to modify the fold-state of a tree externally.

interface TreeFoldControls {
    collapseChildren: ((key) => void);
    expandChildren: ((key) => void);
    get: ((key) => boolean);
    reset: (() => void);
    set: ((key, value) => void);
    toggle: ((key) => void);
    unfoldTo: ((key) => void);
}

Properties

collapseChildren: ((key) => void)

Type declaration

    • (key): void
    • Parameters

      • key: string | Iterable<string>

        will fold all of the given nodes' children

      Returns void

Param: key

will fold all of the given nodes' children

Returns

expandChildren: ((key) => void)

Type declaration

    • (key): void
    • Parameters

      • key: string | Iterable<string>

        will unfold all of the given nodes' children

      Returns void

Param: key

will unfold all of the given nodes' children

Returns

get: ((key) => boolean)

warning: since this is an imperative handle and cannot be used as reative state.

Type declaration

    • (key): boolean
    • warning: since this is an imperative handle and cannot be used as reative state.

      Parameters

      • key: string

        the key of the node that you wish to get the fold state for

      Returns boolean

      the node's current fold state

Param: key

the key of the node that you wish to get the fold state for

Returns

the node's current fold state

reset: (() => void)

resets the fold state of the entire tree to the default.

Type declaration

    • (): void
    • resets the fold state of the entire tree to the default.

      Returns void

Returns

set: ((key, value) => void)

Type declaration

    • (key, value): void
    • Parameters

      • key: string | Iterable<string>

        key (or keys) of the node to set.

      • value: boolean

      Returns void

Param: key

key (or keys) of the node to set.

Param: newState

the open/close state to use

Returns

toggle: ((key) => void)

Type declaration

    • (key): void
    • Parameters

      • key: string | Iterable<string>

        the key (or keys) of the node to toggle the fold state for

      Returns void

Param: key

the key (or keys) of the node to toggle the fold state for

Returns

unfoldTo: ((key) => void)

Type declaration

    • (key): void
    • Parameters

      • key: string | Iterable<string>

        will unfold all nodes from root to the target key.

      Returns void

Param: key

will unfold all nodes from root to the target key.

Returns