PR01 Interactive Property Explorer
Experiment with different property combinations to see their effects
Live Tree Preview
Property Controls
Property Presets
Quick Presets:
PR02 Core Properties
Essential properties that define tree behavior and data structure
Property Details
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
data* (JS only) | Array<object> | [] | Array of tree node objects. Each object must have properties specified by idMember, pathMember, and displayValueMember. |
id-member / idMember | string | 'id' | Property name that contains unique identifiers for each node. |
path-member / pathMember | string | 'path' | Property name that contains the hierarchical path (e.g., "1", "1.1", "1.1.1") using LTree format. |
display-value-member / displayValueMember | string | 'displayValue' | Property name that contains the text to display for each node. |
expand-level / expandLevel | number | 2 | Initial expansion depth. Nodes at this level and above will be expanded by default. |
should-toggle-on-node-click / shouldToggleOnNodeClick | boolean | false | When true, clicking on a node will expand/collapse it instead of just selecting. |
Usage Examples
Implementation Notes
Data Structure Requirements
- Unique IDs: Each node must have a unique identifier
- Path Hierarchy: Use dot notation like "1.2.3" for parent-child relationships
- Flat Array: All nodes in a single array, not nested objects
Path Format Examples
"1"- Root level node"1.1"- Child of node "1""1.1.1"- Grandchild of node "1""2.5.3"- Third child of fifth child of second root
Performance Notes
The component efficiently handles large datasets using the LTree structure for fast hierarchy lookups.
PR03 Styling & Display Properties
Properties that control visual appearance and user interface elements
Styling Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
body-class / bodyClass | string | "" | CSS class applied to the tree body container |
selected-node-class / selectedNodeClass | string | "" | CSS class applied to selected nodes |
drag-over-node-class / dragOverNodeClass | string | "" | CSS class applied during drag operations for visual feedback. Built-in: 'ltree-dragover-highlight', 'ltree-dragover-glow' |
expand-icon-class / expandIconClass | string | "" | CSS class for the expand icon |
collapse-icon-class / collapseIconClass | string | "" | CSS class for the collapse icon (used with toggleIconMode='swap') |
toggle-icon-mode / toggleIconMode | string | 'rotate' | 'rotate' = CSS rotates expandIconClass; 'swap' = swaps between expand/collapse icons |
Styling Examples
CSS Integration
CSS Variables
All CSS variables use the --tv- prefix. Set them on the web-treeview element or a parent container.
Custom Themes
Use the various class properties and CSS variables to implement custom themes, dark modes, or brand-specific styling.
Toggle Icon Modes
rotate(default) - Uses expandIconClass only, CSS rotates 90degswap- Swaps between expandIconClass and collapseIconClass
Shadow DOM Styling
Use customStylesCallback to inject CSS into the Shadow DOM for deep customization.
PR04 Interaction Properties
Properties that control drag and drop, search, and user interactions
Interaction Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
drag-drop-mode / dragDropMode | string | 'none' | Controls drag-drop operations: 'none' | 'cross' | 'both' |
getIsDraggableCallback (JS only) | function | null | Function to check if a node is draggable: (node) => boolean |
search-text / searchText | string | "" | Search query string that filters and highlights matching nodes |
getSearchValueCallback (JS only) | function | null | Custom function to extract searchable text from nodes: (node) => string |
sortCallback (JS only) | function | null | Custom sorting function for tree nodes: (items) => sortedItems |
order-member / orderMember | string | null | Property name containing sort order value for sibling ordering |
allow-copy / allowCopy | boolean | false | Allow Ctrl+drag to copy nodes |
Advanced Usage
Interaction Guide
Drag and Drop
Set drag-drop-mode="both" to enable drag-drop. Use getIsDraggableCallback for per-node control.
Flexible Search
Customize what's searchable with getSearchValueCallback. The tree automatically filters to show matching nodes and their ancestors.
Dynamic Sorting
Sort callbacks receive tree nodes with access to original data via node.data. Useful for sorting by dates, types, or custom criteria.
Performance Tips
Callbacks are called frequently - keep them lightweight and avoid expensive operations.
PR05 Drop Zone Properties
Configure visual drop indicators and positioning for drag-drop operations
Drop Zone Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
drop-zone-mode / dropZoneMode | string | 'floating' | Drop zone rendering: 'floating' | 'glow' |
drop-zone-layout / dropZoneLayout | string | 'around' | Drop zone arrangement: 'around' | 'above' | 'below' | 'wave' | 'wave2' |
drop-zone-start / dropZoneStart | number | string | 33 | Horizontal start position (number = %, string = CSS value like "50px") |
drop-zone-max-width / dropZoneMaxWidth | number | 120 | Maximum width in pixels for wave layouts |
is-loading / isLoading | boolean | false | Shows a loading overlay on the tree during async operations |
Drop Zone Layouts
'around'- Above zone on top, Below/Child zones on bottom (default)'above'- All 3 zones in a horizontal row above the node'below'- All 3 zones in a horizontal row below the node'wave'- Zones stacked vertically with fixed width'wave2'- Diagonal wave pattern with offset
Usage Examples
Configuration Guide
Drop Positions
When dropping a node, the position parameter indicates:
'above'- Insert as sibling before target'below'- Insert as sibling after target'child'- Insert as child of target
Touch Support
Touch drag-drop is enabled by default:
- Long-press (300ms) initiates drag
- Ghost element follows finger
- Haptic feedback on drag start
Loading State
Use is-loading attribute or isLoading property to show a visual overlay during async operations.
Empty Tree Drops
Use renderEmptyZoneCallback to create custom drop targets for empty trees.
PR06 Performance & Rendering
Progressive rendering and virtual scroll for optimal performance with large trees
Rendering Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
progressive-render / progressiveRender | boolean | true | Render nodes progressively in batches to prevent UI freeze. |
initial-batch-size / initialBatchSize | number | 20 | First batch size. Renders instantly for immediate visual feedback. |
max-batch-size / maxBatchSize | number | 500 | Maximum batch size cap. Batches double each frame up to this limit. |
virtual-scroll / virtualScroll | boolean | false | Enable virtual scroll rendering for very large datasets. |
virtual-row-height / virtualRowHeight | number | 32 | Row height in pixels for virtual scroll calculations. |
virtual-overscan / virtualOverscan | number | 5 | Number of extra rows to render outside visible area. |
onRenderStart (JS only) | () => void | null | Callback when progressive rendering begins. |
onRenderProgress (JS only) | (stats) => void | null | Callback with render progress stats (pending, processed). |
onRenderComplete (JS only) | (stats) => void | null | Callback when all nodes have been rendered. |
Usage Examples
Performance Guide
Exponential Batching
Batches grow: 20 -> 40 -> 80 -> 160 -> 320 -> 500 (capped). For 5000 nodes, this means ~8 batches instead of 25 with fixed sizing.
Performance Impact
- Progressive: Instant first 20 nodes, smooth fill-in
- Virtual scroll: Only renders visible rows, handles 100K+ nodes
- UI: Remains responsive during rendering
Virtual Scroll
Enable virtual-scroll for datasets with thousands of nodes. Only visible rows plus overscan are rendered in the DOM.
Choosing a Mode
- Small trees (<500): Default progressive rendering
- Large trees (500-5000): Progressive with tuned batch sizes
- Huge trees (5000+): Virtual scroll
PR07 Callback Properties
Event callbacks set as JS properties for handling user interactions
Callback Properties
| Property (JS only) | Signature | Description |
|---|---|---|
onNodeClicked | (node: TreeNode) => void | Called when a node is clicked |
onNodeDragStart | (node, event) => void | Called when drag operation begins |
onNodeDrop | (dropNode, draggedNode, position, event, operation) => void | Called when node is dropped. position is 'above'|'below'|'child'. dropNode can be null. |
beforeDropCallback | (dropNode, draggedNode, position, event, operation) => boolean | { position? } | Promise | Async validation before drop. Return false to cancel, or override position. |
contextMenuCallback | (node, closeMenu) => ContextMenuEntry[] | Returns context menu items for a node |
node-clicked, node-drop) for addEventListener usage.Usage Examples
Guide
Two Approaches
| JS Property | addEventListener |
|---|---|
tree.onNodeClicked = fn | tree.addEventListener('node-clicked', fn) |
tree.onNodeDrop = fn | tree.addEventListener('node-drop', fn) |
onNodeDrop Parameters
position: 'above' | 'below' | 'child'operation: 'move' | 'copy'dropNode: null for root/empty tree drops
Async beforeDropCallback
Validate or modify drops with async support:
- Return
falseto cancel the drop - Return
trueto allow - Return
{ position: 'below' }to override position - Supports
async/awaitfor confirmation dialogs