Installation
Add the treeview component to your project
Package Manager
npm
pnpm
yarn
Verify Installation
Verify Import
Requirements
Requirements
- Svelte 5 - Uses modern runes syntax
- SvelteKit - For proper module resolution
- TypeScript - Optional but recommended
Browser Support
Modern browsers with ES2020 support. IE11 is not supported.
Quick Start
Get a basic tree up and running in minutes
Live Example
Complete Code
Basic Usage
Key Concepts
Required Properties
data- Array of tree nodesidMember- Property for unique IDspathMember- Property for hierarchical pathsdisplayValueMember- Property to display
Path Structure
Paths define hierarchy: "1" (root), "1.1" (child), "1.1.1" (grandchild). This LTree-inspired structure is efficient and flexible.
Basic Configuration
Customize behavior and appearance
Configured Tree
Configuration Code
With Configuration
Configuration Options
Common Options
expandLevel- Auto-expand depth (default: 2)shouldToggleOnNodeClick- Click to expand/collapsesortCallback- Custom sorting function
Sorting
Sort callback receives array of tree nodes with .data property containing your original data object.
Custom Data
Add any properties to your data objects - they're accessible
via node.data in callbacks and templates.
Next Steps
Common Patterns
File System Tree
File System Structure
Navigation Menu
Navigation Structure