Tree Views
Display information in a hierarchical structure using collapsible nodes.
import { TreeView, TreeViewItem, RecursiveTreeView, type TreeViewNode } from '@skeletonlabs/skeleton';
Demo
Item 1
Item 1
Child 1
Child 1
Child of Child 1
Child of Child 1
Child of Child 2
Child of Child 2
Child 2
Child 2
Item 2
Item 2
Child
Child
Icons
Folder
Folder
File 1
File 1
File 2
File 2
Disabled State
Books
Books
Clean Code
Clean Code
The Clean Coder
The Clean Coder
The Art of Unix Programming
The Art of Unix Programming
Movies
Movies
Clean Code
Clean Code
The Clean Coder
The Clean Coder
The Art of Unix Programming
The Art of Unix Programming
TV
TV
Expand & Collapse
We can bind the tree view and trigger methods for expanding or collapsing all children at once.
Books
Books
Clean Code
Clean Code
The Clean Coder
The Clean Coder
The Art of Unix Programming
The Art of Unix Programming
Movies
Movies
The Flash
The Flash
Guardians of the Galaxy
Guardians of the Galaxy
Black Panther
Black Panther
TV
TV
The Simpsons
The Simpsons
Rick and Morty
Rick and Morty
Family Guy
Family Guy
Selection
Each tree view provides a number of selection options.
Single
When using single selection, our items are setup and treated as radio inputs.
Books
Books
Clean Code
Clean Code
The Clean Coder
The Clean Coder
The Art of Unix Programming
The Art of Unix Programming
Movies
Movies
TV
TV
Multiple
When using multiple selection, our items are setup and treated as checkbox inputs.
Books
Books
Clean Code
Clean Code
The Clean Coder
The Clean Coder
The Art of Unix Programming
The Art of Unix Programming
Movies
Movies
TV
TV
Relational
Use the children
prop to create a relational connection between parent and children.
Books
Books
Clean Code
Clean Code
The Clean Coder
The Clean Coder
The Art of Unix Programming
The Art of Unix Programming
Movies
Movies
TV
TV
Books
Books
Clean Code
Clean Code
The Clean Coder
The Clean Coder
The Art of Unix Programming
The Art of Unix Programming
Movies
Movies
TV
TV
Recursive Mode
Tree views can be generated with a recursive data-driven method using the RecursiveTreeView
components.
programming
language
javascript
c#
rust
database
mongodb
mssql
casandra
framework
svelte
angular
react
books
clean code
clean code - section 1
clean code - section 2
clean code - section 3
structure
structure - section 1
structure - section 2
structure - section 3
clean coder
clean coder - section 1
clean coder - section 2
clean coder - section 3
series
Mr. Robot
Mr. Robot - season 1
Mr. Robot - season 2
Mr. Robot - season 3
silicon valley
silicon valley - season 1
silicon valley - season 2
silicon valley - season 3
code monkeys
code monkeys - season 1
code monkeys - season 2
code monkeys - season 3
Expanded
To access and modify the expanded nodes use expandedNodes
array prop.
programming
language
javascript
c#
rust
database
mongodb
mssql
casandra
framework
svelte
angular
react
books
clean code
clean code - section 1
clean code - section 2
clean code - section 3
structure
structure - section 1
structure - section 2
structure - section 3
clean coder
clean coder - section 1
clean coder - section 2
clean coder - section 3
series
Mr. Robot
Mr. Robot - season 1
Mr. Robot - season 2
Mr. Robot - season 3
silicon valley
silicon valley - season 1
silicon valley - season 2
silicon valley - season 3
code monkeys
code monkeys - season 1
code monkeys - season 2
code monkeys - season 3
Disabled
To access and modify the disabled nodes use disabledNodes
array prop.
programming
language
javascript
c#
rust
database
mongodb
mssql
casandra
framework
svelte
angular
react
books
clean code
clean code - section 1
clean code - section 2
clean code - section 3
structure
structure - section 1
structure - section 2
structure - section 3
clean coder
clean coder - section 1
clean coder - section 2
clean coder - section 3
series
Mr. Robot
Mr. Robot - season 1
Mr. Robot - season 2
Mr. Robot - season 3
silicon valley
silicon valley - season 1
silicon valley - season 2
silicon valley - season 3
code monkeys
code monkeys - season 1
code monkeys - season 2
code monkeys - season 3
Selection
Just like normal Tree-view, Recursive Tree-view supports selection with both single and multiple modes.
To access and modify the checked nodes use checkedNodes
array prop.
programming
language
javascript
c#
rust
database
mongodb
mssql
casandra
framework
svelte
angular
react
books
clean code
clean code - section 1
clean code - section 2
clean code - section 3
structure
structure - section 1
structure - section 2
structure - section 3
clean coder
clean coder - section 1
clean coder - section 2
clean coder - section 3
series
Mr. Robot
Mr. Robot - season 1
Mr. Robot - season 2
Mr. Robot - season 3
silicon valley
silicon valley - season 1
silicon valley - season 2
silicon valley - season 3
code monkeys
code monkeys - season 1
code monkeys - season 2
code monkeys - season 3
Relational Selection
Just like normal Tree-view, Recursive Tree-view supports relational selection using the prop relational
.
To access and modify the checked nodes use checkedNodes
array prop.
In multiple relational selection mode, an extra array prop indeterminateNodes
is available to indicate indeterminate
nodes.