Skip to main content
Version: 1.0.4

ITreeViewProps

@spartanfx/react v1.0.4


@spartanfx/react / ITreeViewProps

Interface: ITreeViewProps<TItem>

Props for the TreeView component.

Type Parameters

TItem

TItem = any

Properties

PropertyTypeDescription
appearance?AppearanceModeAppearance mode for the tree (light or dark). Default AppearanceMode.light
ariaLabel?stringARIA label for the tree.
ariaLabelledBy?stringARIA labelledby attribute for the tree.
burgerBreakpointPx?numberBreakpoint in pixels for responsive burger menu mode. Default 768
canDrag?(node) => booleanPermission function to determine if a node can be dragged.
canDrop?(sourceNode, targetNode, position) => booleanPermission function to determine if a node can be dropped at a target.
classes?ITreeViewClassNamesCSS class name overrides for component elements.
className?stringCSS class name for the root container.
defaultExpandedIds?string[]Default expanded node IDs for uncontrolled mode.
defaultSelectedId?stringDefault selected node ID for uncontrolled mode.
enableDragDrop?booleanEnable drag & drop reordering. Default false
expandedIds?string[]Controlled array of expanded node IDs. Use with onExpandedChange for controlled expansion.
expandOnClick?booleanIf true, clicking anywhere on the node expands/collapses it. If false, only clicking the caret icon expands/collapses. Default false
getIconForNode?(node) => ReactNodeFunction to dynamically determine icon for a specific node. Overrides iconsPerLevel if provided.
getValue?(item, field) => anyOptional custom function to retrieve field values from items. If provided, overrides direct property access.
iconsPerLevel?Record<number, ReactNode>Icon to display for each depth level. Keys are depth levels (0 = root), values are React nodes.
itemsTItem[]Array of items to display in the tree. Can be flat (with id/parentId) or nested (with children array).
onExpandedChange?(ids) => voidCallback fired when node expansion state changes.
onReOrder?(event) => voidCallback fired when a node is reordered via drag & drop. Receives updated items array and reorder metadata.
onSelect?(id, node) => voidCallback fired when a node is selected.
renderItem?(args) => ReactNodeCustom render function for tree items. If provided, you have full control over item rendering.
responsiveMode?ResponsiveModeResponsive mode for burger menu display. - 'auto': Show burger menu below breakpoint - 'always': Always show burger menu - 'never': Never show burger menu Default 'auto'
schemaITreeViewSchema<TItem>ITreeViewSchema configuration defining how to map item fields to tree structure.
selectedId?stringControlled selected node ID. Use with onSelect for controlled selection.
showExpandCollapseIcon?booleanWhether to show expand/collapse caret icons. Default true
style?CSSPropertiesInline styles for the root container.
tokens?ITreeViewTokensDesign tokens for theming.