Recursive Mode
- Tree views can be generated using a recursive data-driven method.
+
+ Tree views can be generated with a recursive data-driven method using the RecursiveTreeView components.
+
-
+
+ To get expected results make sure to include a unique Id for each node.
+
`}
/>
-
- Single Selection
+
+ Expanded
- Relational checking is automatically applied when generating your list in a recursive manner. Setting a child as checked will not automatically affect the parent.
+ To access and modify the expanded nodes use expandedNodes array prop.
-
+
+
`}
/>
+
+ Expanded nodes: {expandedNodes}
+
-
- Multiple Selection
- Relational checking is automatically applied when generating your list in a recursive manner.
+
+ Disabled
+
+
+ To access and modify the disabled nodes use disabledNodes array prop.
+
-
+
+
+ `}
+ />
+
+
+ Disabled nodes: {disabledNodes}
+
+
+
+ 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.
+
+
+
+
+
+
+
+ `}
+ />
+
+
+ checked nodes: {singleCheckedNodes}
+
+
+
+
+ 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.
+
+
+
+
+
+
+
+
`}
/>
+
+ indeterminate nodes: {indeterminateNodes}
+
diff --git a/sites/skeleton.dev/src/routes/(inner)/components/tree-views/exampleData.ts b/sites/skeleton.dev/src/routes/(inner)/components/tree-views/exampleData.ts
new file mode 100644
index 0000000000..c99c8a596f
--- /dev/null
+++ b/sites/skeleton.dev/src/routes/(inner)/components/tree-views/exampleData.ts
@@ -0,0 +1,223 @@
+import type { TreeViewNode } from '@skeletonlabs/skeleton';
+
+export const nodes: TreeViewNode[] = [
+ {
+ id: 'programming',
+ content: 'programming',
+ value: 'programming',
+ children: [
+ {
+ id: 'language',
+ content: 'language',
+ value: 'language',
+ children: [
+ {
+ id: 'javascript',
+ content: 'javascript',
+ value: 'javascript'
+ },
+ {
+ id: 'c#',
+ content: 'c#',
+ value: 'c#'
+ },
+ {
+ id: 'rust',
+ content: 'rust',
+ value: 'rust'
+ }
+ ]
+ },
+ {
+ content: 'database',
+ value: 'database',
+ id: 'database',
+ children: [
+ {
+ id: 'mongodb',
+ content: 'mongodb',
+ value: 'mongodb'
+ },
+ {
+ id: 'mssql',
+ content: 'mssql',
+ value: 'mssql'
+ },
+ {
+ id: 'casandra',
+ content: 'casandra',
+ value: 'casandra'
+ }
+ ]
+ },
+ {
+ content: 'framework',
+ value: 'framework',
+ id: 'framework',
+ children: [
+ {
+ id: 'svelte',
+ content: 'svelte',
+ value: 'svelte'
+ },
+ {
+ id: 'angular',
+ content: 'angular',
+ value: 'angular'
+ },
+ {
+ id: 'react',
+ content: 'react',
+ value: 'react'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ content: 'books',
+ value: 'books',
+ id: 'books',
+ children: [
+ {
+ id: 'clean code',
+ content: 'clean code',
+ value: 'clean code',
+ children: [
+ {
+ id: 'clean code - section 1',
+ content: 'clean code - section 1',
+ value: 'clean code - section 1'
+ },
+ {
+ id: 'clean code - section 2',
+ content: 'clean code - section 2',
+ value: 'clean code - section 2'
+ },
+ {
+ id: 'clean code - section 3',
+ content: 'clean code - section 3',
+ value: 'clean code - section 3'
+ }
+ ]
+ },
+ {
+ id: 'structure',
+ content: 'structure',
+ value: 'structure',
+ children: [
+ {
+ id: 'structure - section 1',
+ content: 'structure - section 1',
+ value: 'structure - section 1'
+ },
+ {
+ id: 'structure - section 2',
+ content: 'structure - section 2',
+ value: 'structure - section 2'
+ },
+ {
+ id: 'structure - section 3',
+ content: 'structure - section 3',
+ value: 'structure - section 3'
+ }
+ ]
+ },
+ {
+ id: 'clean coder',
+ content: 'clean coder',
+ value: 'clean coder',
+ children: [
+ {
+ id: 'clean coder - section 1',
+ content: 'clean coder - section 1',
+ value: 'clean coder - section 1'
+ },
+ {
+ id: 'clean coder - section 2',
+ content: 'clean coder - section 2',
+ value: 'clean coder - section 2'
+ },
+ {
+ id: 'clean coder - section 3',
+ content: 'clean coder - section 3',
+ value: 'clean coder - section 3'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ id: 'series',
+ content: 'series',
+ value: 'series',
+ children: [
+ {
+ id: 'Mr. Robot',
+ content: 'Mr. Robot',
+ value: 'Mr. Robot',
+ children: [
+ {
+ id: 'Mr. Robot - season 1',
+ content: 'Mr. Robot - season 1',
+ value: 'Mr. Robot - season 1'
+ },
+ {
+ id: 'Mr. Robot - season 2',
+ content: 'Mr. Robot - season 2',
+ value: 'Mr. Robot - season 2'
+ },
+ {
+ id: 'Mr. Robot - season 3',
+ content: 'Mr. Robot - season 3',
+ value: 'Mr. Robot - season 3'
+ }
+ ]
+ },
+ {
+ id: 'silicon valley',
+ content: 'silicon valley',
+ value: 'silicon valley',
+ children: [
+ {
+ id: 'silicon valley - season 1',
+ content: 'silicon valley - season 1',
+ value: 'silicon valley - season 1'
+ },
+ {
+ id: 'silicon valley - season 2',
+ content: 'silicon valley - season 2',
+ value: 'silicon valley - season 2'
+ },
+ {
+ id: 'silicon valley - season 3',
+ content: 'silicon valley - season 3',
+ value: 'silicon valley - season 3'
+ }
+ ]
+ },
+ {
+ id: 'code monkeys',
+ content: 'code monkeys',
+ value: 'code monkeys',
+ children: [
+ {
+ id: 'code monkeys - season 1',
+ content: 'code monkeys - season 1',
+ value: 'code monkeys - season 1'
+ },
+ {
+ id: 'code monkeys - season 2',
+ content: 'code monkeys - season 2',
+ value: 'code monkeys - season 2'
+ },
+ {
+ id: 'code monkeys - season 3',
+ content: 'code monkeys - season 3',
+ value: 'code monkeys - season 3'
+ }
+ ]
+ }
+ ]
+ }
+];