@itwin/itwinui-react
Version:
A react component library for iTwinUI
39 lines (38 loc) • 1.27 kB
TypeScript
import * as React from 'react';
import type { Virtualizer } from '@tanstack/react-virtual';
export type TreeContextProps = {
/**
* Depth of the node.
*/
nodeDepth: number;
/**
* List of sub-node IDs. Used for an accessibility attribute and keyboard navigation.
*/
subNodeIds?: string[];
/**
* ID of the parent node. Used for keyboard navigation.
*/
parentNodeId?: string;
/**
* Number of nodes that are under the same parent node or in the root. Used for an accessibility attribute.
*/
groupSize: number;
/**
* Node index in the list of nodes under the same parent node or in the root. Used for an accessibility attribute.
*/
indexInGroup: number;
/**
* Function that scrolls to the node's parent node.
*/
scrollToParent?: () => void;
/**
* Size of the tree.
*/
size?: 'default' | 'small';
};
export declare const TreeContext: React.Context<TreeContextProps | undefined>;
export declare const useTreeContext: () => TreeContextProps;
export declare const VirtualizedTreeContext: React.Context<{
virtualizer?: Virtualizer<Element, Element>;
onVirtualizerChange?: (virtualizer?: Virtualizer<Element, Element>) => void;
} | undefined>;