PR01 Interactive Property Explorer

Experiment with different property combinations to see their effects

Live Tree Preview
Property Controls
Property Presets
Quick Presets:
Select a preset to quickly configure the tree with common property combinations.

PR02 Core Properties

Essential properties that define tree behavior and data structure

Property Details
Attribute / PropertyTypeDefaultDescription
data* (JS only)Array<object>[]Array of tree node objects. Each object must have properties specified by idMember, pathMember, and displayValueMember.
id-member / idMemberstring'id'Property name that contains unique identifiers for each node.
path-member / pathMemberstring'path'Property name that contains the hierarchical path (e.g., "1", "1.1", "1.1.1") using LTree format.
display-value-member / displayValueMemberstring'displayValue'Property name that contains the text to display for each node.
expand-level / expandLevelnumber2Initial expansion depth. Nodes at this level and above will be expanded by default.
should-toggle-on-node-click / shouldToggleOnNodeClickbooleanfalseWhen true, clicking on a node will expand/collapse it instead of just selecting.
* Required properties highlighted in yellow
Usage Examples
Data Structure & Usage
 
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 / PropertyTypeDefaultDescription
body-class / bodyClassstring""CSS class applied to the tree body container
selected-node-class / selectedNodeClassstring""CSS class applied to selected nodes
drag-over-node-class / dragOverNodeClassstring""CSS class applied during drag operations for visual feedback. Built-in: 'ltree-dragover-highlight', 'ltree-dragover-glow'
expand-icon-class / expandIconClassstring""CSS class for the expand icon
collapse-icon-class / collapseIconClassstring""CSS class for the collapse icon (used with toggleIconMode='swap')
toggle-icon-mode / toggleIconModestring'rotate''rotate' = CSS rotates expandIconClass; 'swap' = swaps between expand/collapse icons
Styling Examples
Custom Styling
 
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 90deg
  • swap - 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 / PropertyTypeDefaultDescription
drag-drop-mode / dragDropModestring'none'Controls drag-drop operations: 'none' | 'cross' | 'both'
getIsDraggableCallback (JS only)functionnullFunction to check if a node is draggable: (node) => boolean
search-text / searchTextstring""Search query string that filters and highlights matching nodes
getSearchValueCallback (JS only)functionnullCustom function to extract searchable text from nodes: (node) => string
sortCallback (JS only)functionnullCustom sorting function for tree nodes: (items) => sortedItems
order-member / orderMemberstringnullProperty name containing sort order value for sibling ordering
allow-copy / allowCopybooleanfalseAllow Ctrl+drag to copy nodes
Advanced Usage
Advanced Interactions
 
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 / PropertyTypeDefaultDescription
drop-zone-mode / dropZoneModestring'floating'Drop zone rendering: 'floating' | 'glow'
drop-zone-layout / dropZoneLayoutstring'around'Drop zone arrangement: 'around' | 'above' | 'below' | 'wave' | 'wave2'
drop-zone-start / dropZoneStartnumber | string33Horizontal start position (number = %, string = CSS value like "50px")
drop-zone-max-width / dropZoneMaxWidthnumber120Maximum width in pixels for wave layouts
is-loading / isLoadingbooleanfalseShows 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
Drop Zone Configuration
 
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 / PropertyTypeDefaultDescription
progressive-render / progressiveRenderbooleantrueRender nodes progressively in batches to prevent UI freeze.
initial-batch-size / initialBatchSizenumber20First batch size. Renders instantly for immediate visual feedback.
max-batch-size / maxBatchSizenumber500Maximum batch size cap. Batches double each frame up to this limit.
virtual-scroll / virtualScrollbooleanfalseEnable virtual scroll rendering for very large datasets.
virtual-row-height / virtualRowHeightnumber32Row height in pixels for virtual scroll calculations.
virtual-overscan / virtualOverscannumber5Number of extra rows to render outside visible area.
onRenderStart (JS only)() => voidnullCallback when progressive rendering begins.
onRenderProgress (JS only)(stats) => voidnullCallback with render progress stats (pending, processed).
onRenderComplete (JS only)(stats) => voidnullCallback when all nodes have been rendered.
Progressive rendering is enabled by default. First 20 nodes render instantly, then batches double (20 -> 40 -> 80 -> 160...) for optimal perceived performance.
Usage Examples
Progressive & Virtual Rendering
 
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)SignatureDescription
onNodeClicked(node: TreeNode) => voidCalled when a node is clicked
onNodeDragStart(node, event) => voidCalled when drag operation begins
onNodeDrop(dropNode, draggedNode, position, event, operation) => voidCalled when node is dropped. position is 'above'|'below'|'child'. dropNode can be null.
beforeDropCallback(dropNode, draggedNode, position, event, operation) => boolean | { position? } | PromiseAsync validation before drop. Return false to cancel, or override position.
contextMenuCallback(node, closeMenu) => ContextMenuEntry[]Returns context menu items for a node
Note: Callbacks are set as JS properties on the element. The component also emits CustomEvents (e.g. node-clicked, node-drop) for addEventListener usage.
Usage Examples
Callback Properties
 
Guide
Two Approaches
JS PropertyaddEventListener
tree.onNodeClicked = fntree.addEventListener('node-clicked', fn)
tree.onNodeDrop = fntree.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 false to cancel the drop
  • Return true to allow
  • Return { position: 'below' } to override position
  • Supports async/await for confirmation dialogs