react-win7-treeview
Version:
A Windows 7 styled TreeView component for React with animated expand/collapse, line connectors, and RTL support.
32 lines (31 loc) • 1.29 kB
TypeScript
import React, { type ReactNode } from "react";
export interface TreeViewItemProps<T = any> {
label: ReactNode;
value?: T;
children?: ReactNode;
/** If true, the node starts expanded (uncontrolled mode) */
defaultOpen?: boolean;
/** Controlled expansion state */
expanded?: boolean;
/** Called when expansion changes */
onToggle?: (expanded: boolean, value?: T) => void;
/** Whether the whole row or only the label toggles selection/expand */
toggleMode?: "row" | "label";
/** Text direction support */
direction?: "ltr" | "rtl";
className?: string;
/** Custom control box renderer */
controlBox?: (open: boolean) => ReactNode;
expandIcon?: ReactNode;
collapseIcon?: ReactNode;
/** Child indentation in pixels */
indent?: number;
/** Show expand/collapse icon */
showIcon?: boolean;
/** Selection and interaction */
selected?: boolean;
disabled?: boolean;
onSelect?: (value?: T) => void;
}
export declare const TreeViewItem: <T>({ label, value, children, defaultOpen, expanded, onToggle, toggleMode, direction, className, controlBox, expandIcon, collapseIcon, indent, showIcon, selected, disabled, onSelect, }: TreeViewItemProps<T>) => React.JSX.Element;
export default TreeViewItem;