You can use the <Tree>
component imported from $lib/components
. Pass it a tree of files and directory to be displayed interactively.
Demo
Loading...
Definition
Tree
The tree component.
tree
array
Required
Default: []
The actual array of the tree.
tree.name
string
Required
The file or directory name.
tree.open
boolean
Default: true
If the children is a directory, controls whether the children are displayed.
tree.children
array
The list of children of a directory.
tree.highlighted
boolean
Default: false
Controls weather to hight a directory or file.
NOTE : For a single file, instead of using an object with a name, you can just use a string representing it's name
Last updated : Aug 9, 2024