@flanksource/clicky-ui
Version:
Flanksource Clicky UI — React component library built on shadcn/ui with light/dark and density theming.
35 lines • 1.74 kB
TypeScript
import { ReactNode } from 'react';
import { TreeNodeProps } from './TreeNode';
export type TreeProps<T> = Omit<TreeNodeProps<T>, "node" | "depth" | "expandAll" | "forcedOpenKeys"> & {
roots: T[];
empty?: ReactNode;
className?: string;
/**
* Render the Expand all / Collapse all toolbar above the tree. Enabled by
* default. Set to false to suppress when the tree is tiny or the controls
* are owned externally.
*/
showControls?: boolean;
/**
* Externally controlled expand-all state. When provided together with
* `onExpandAllChange`, the tree is controlled; otherwise it manages the
* toolbar state internally.
*/
expandAll?: boolean | null;
onExpandAllChange?: (next: boolean | null) => void;
toolbarClassName?: string;
/**
* Override the text the filter matches against for a given node.
* Defaults to a recursive walk of the node's own fields (excluding
* its `children` and any secondary children), which works for
* plain-shape trees but leaks text from nested domain objects —
* e.g. a SQL Table's Field rows are marked secondary, yet the
* parent record still carries `record.fields[].field` strings that
* the default walker would collect. Callers that need precise
* control over search behaviour should return only the text they
* want surfaced (the node's own display label / id / type).
*/
getSearchText?: (node: T) => string;
};
export declare function Tree<T>({ roots, empty, className, showControls, expandAll: controlledExpandAll, onExpandAllChange, toolbarClassName, getSearchText, ...nodeProps }: TreeProps<T>): import("react/jsx-runtime").JSX.Element;
//# sourceMappingURL=Tree.d.ts.map