@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
36 lines (35 loc) • 1.83 kB
TypeScript
import type { FlatTreeLineState } from './flatten-tree-data/flatten-tree-data';
import type { RenderNode, TreeNodeData } from './Tree';
import type { TreeController } from './use-tree';
export interface FlatTreeNodeProps {
/** Node data from tree data */
node: TreeNodeData;
/** Nesting level of the node, starts at 1 */
level: number;
/** Value of the parent node, `null` for root nodes */
parent: string | null;
/** Whether the node has children */
hasChildren: boolean;
/** Whether the node is expanded */
expanded: boolean;
/** Tree controller instance, return value of `useTree` hook */
tree: TreeController;
/** If set, tree node with children is expanded on click @default true */
expandOnClick?: boolean;
/** If set, tree node is selected on click @default false */
selectOnClick?: boolean;
/** If set, tree node with children is expanded on space key press @default true */
expandOnSpace?: boolean;
/** If set, tree node is checked on space key press @default false */
checkOnSpace?: boolean;
/** A function to render tree node label */
renderNode?: RenderNode;
/** Style to apply to the root element, used for virtualizer positioning */
style?: React.CSSProperties;
/** Tab index for the node */
tabIndex?: number;
/** Line state per ancestor + own level, computed by `flattenTreeData`.
* When provided and the tree root has `data-with-lines`, connector lines are rendered. */
linesPath?: FlatTreeLineState[];
}
export declare const FlatTreeNode: import("react").MemoExoticComponent<({ node, level, parent, hasChildren, expanded, tree, expandOnClick, selectOnClick, expandOnSpace, checkOnSpace, renderNode, style, tabIndex, linesPath, }: FlatTreeNodeProps) => import("react/jsx-runtime").JSX.Element>;