File System
node_modules
@skeletonlabs
skeleton
package.json
File System
node_modules
@skeletonlabs
skeleton
package.json
Controlled
File System
node_modules
@skeletonlabs
skeleton
package.json
File System
node_modules
@skeletonlabs
skeleton
package.json
Multiple Selection
- Windows: Hold Ctrl + left click with mouse.
- MacOS: Hold ⌘ + left click with mouse.
File System
node_modules
@skeletonlabs
skeleton
package.json
File System
node_modules
@skeletonlabs
skeleton
package.json
Collapse and Expand
Use the Provider Pattern to gain access to the collapse and expand methods on the TreeView instance.
File System
node_modules
@skeletonlabs
skeleton
package.json
File System
node_modules
@skeletonlabs
skeleton
package.json
Lazy Loading
File System
node_modules
package.json
File System
node_modules
package.json
API Reference
Root
| Property | Default | Type |
|---|---|---|
collection | - | TreeCollection<any> | undefinedThe tree collection data |
ids | - | Partial<{ root: string; tree: string; label: string; node: (value: string) => string; }> | undefined The ids of the tree elements. Useful for composition. |
expandedValue | - | string[] | undefinedThe controlled expanded node ids |
defaultExpandedValue | - | string[] | undefinedThe initial expanded node ids when rendered. Use when you don't need to control the expanded node value. |
selectedValue | - | string[] | undefinedThe controlled selected node value |
defaultSelectedValue | - | string[] | undefinedThe initial selected node value when rendered. Use when you don't need to control the selected node value. |
defaultCheckedValue | - | string[] | undefinedThe initial checked node value when rendered. Use when you don't need to control the checked node value. |
checkedValue | - | string[] | undefinedThe controlled checked node value |
defaultFocusedValue | - | string | null | undefinedThe initial focused node value when rendered. Use when you don't need to control the focused node value. |
focusedValue | - | string | null | undefinedThe value of the focused node |
selectionMode | "single" | "single" | "multiple" | undefinedWhether the tree supports multiple selection - "single": only one node can be selected - "multiple": multiple nodes can be selected |
onExpandedChange | - | ((details: ExpandedChangeDetails<any>) => void) | undefinedCalled when the tree is opened or closed |
onSelectionChange | - | ((details: SelectionChangeDetails<any>) => void) | undefinedCalled when the selection changes |
onFocusChange | - | ((details: FocusChangeDetails<any>) => void) | undefinedCalled when the focused node changes |
onCheckedChange | - | ((details: CheckedChangeDetails) => void) | undefinedCalled when the checked value changes |
canRename | - | ((node: any, indexPath: IndexPath) => boolean) | undefinedFunction to determine if a node can be renamed |
onRenameStart | - | ((details: RenameStartDetails<any>) => void) | undefinedCalled when a node starts being renamed |
onBeforeRename | - | ((details: RenameCompleteDetails) => boolean) | undefinedCalled before a rename is completed. Return false to prevent the rename. |
onRenameComplete | - | ((details: RenameCompleteDetails) => void) | undefinedCalled when a node label rename is completed |
onLoadChildrenComplete | - | ((details: LoadChildrenCompleteDetails<any>) => void) | undefinedCalled when a node finishes loading children |
onLoadChildrenError | - | ((details: LoadChildrenErrorDetails<any>) => void) | undefinedCalled when loading children fails for one or more nodes |
expandOnClick | true | boolean | undefinedWhether clicking on a branch should open it or not |
typeahead | true | boolean | undefinedWhether the tree supports typeahead search |
loadChildren | - | ((details: LoadChildrenDetails<any>) => Promise<any[]>) | undefinedFunction to load children for a node asynchronously. When provided, branches will wait for this promise to resolve before expanding. |
dir | "ltr" | "ltr" | "rtl" | undefinedThe document's text/writing direction. |
getRootNode | - | (() => ShadowRoot | Node | Document) | undefinedA root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
RootProvider
| Property | Default | Type |
|---|---|---|
value | - | () => TreeViewApi<PropTypes, any> |
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
RootContext
| Property | Default | Type |
|---|---|---|
children | - | Snippet<[() => TreeViewApi<PropTypes, any>]> |
Tree
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
Label
| Property | Default | Type |
|---|---|---|
level | - | 1 | 2 | 3 | 4 | 5 | 6 | undefinedThe level of the heading. |
element | - | Snippet<[HTMLAttributes<"h3">]> | undefinedRender the element yourself |
NodeProvider
| Property | Default | Type |
|---|---|---|
value | - | NodeProps |
children | - | Snippet<[]> | undefinedThe default slot content to be rendered within the component. |
Branch
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
BranchControl
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
BranchText
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"span">]> | undefinedRender the element yourself |
BranchIndicator
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"span">]> | undefinedRender the element yourself |
BranchContent
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
BranchIndentGuide
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |
Item
| Property | Default | Type |
|---|---|---|
element | - | Snippet<[HTMLAttributes<"div">]> | undefinedRender the element yourself |