UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

27 lines (26 loc) 1.11 kB
import type { TreeNodeData } from './Tree'; export type TreeExpandedState = Record<string, boolean>; export interface UseTreeInput { initialExpandedState?: TreeExpandedState; initialSelectedState?: string[]; multiple?: boolean; } export declare function useTree({ initialSelectedState, initialExpandedState, multiple, }?: UseTreeInput): { multiple: boolean; expandedState: TreeExpandedState; selectedState: string[]; anchorNode: string | null; initialize: (data: TreeNodeData[]) => void; toggleExpanded: (value: string) => void; collapse: (value: string) => void; expand: (value: string) => void; expandAllNodes: () => void; collapseAllNodes: () => void; setExpandedState: import("react").Dispatch<import("react").SetStateAction<TreeExpandedState>>; toggleSelected: (value: string) => void; select: (value: string) => void; deselect: (value: string) => void; clearSelected: () => void; setSelectedState: import("react").Dispatch<import("react").SetStateAction<string[]>>; }; export type TreeController = ReturnType<typeof useTree>;