- Prop
nodes- Type
TreeNode[]- Default
- —
- Requirement
- required
Docs Components Advanced
FileTree
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
const fileTreeFixture = { id: "file-tree", repo: "ledger-api", nodes: [ { name: "src", defaultOpen: true, children: [ { name: "charge.ts", git: "M" as const }, { name: "ledger.ts" }, ], }, { name: "README.md" }, ], defaultSelected: "/src/charge.ts",}; import { FileTree } from "@grassroot/ui-react/advanced"; export default function FileTreeDemo() { const { id: _id, ...props } = fileTreeFixture; return ( <div> <FileTree {...props} /> </div> );}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">const fileTreeFixture = { id: "file-tree", repo: "ledger-api", nodes: [ { name: "src", defaultOpen: true, children: [ { name: "charge.ts", git: "M" as const }, { name: "ledger.ts" }, ], }, { name: "README.md" }, ], defaultSelected: "/src/charge.ts",}; import { FileTree } from "@grassroot/ui-vue";</script> <template> <div> <FileTree :nodes="fileTreeFixture.nodes" :repo="fileTreeFixture.repo" :default-selected="fileTreeFixture.defaultSelected" /> </div></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component } from "@angular/core";const fileTreeFixture = { id: "file-tree", repo: "ledger-api", nodes: [ { name: "src", defaultOpen: true, children: [ { name: "charge.ts", git: "M" as const }, { name: "ledger.ts" }, ], }, { name: "README.md" }, ], defaultSelected: "/src/charge.ts",}; import { GrassrootFileTree } from "@grassroot/ui-angular"; @Component({ selector: "app-file-tree-demo", standalone: true, imports: [GrassrootFileTree], template: ` <div> <grassroot-file-tree [nodes]="fixture.nodes" [repo]="fixture.repo" [defaultSelected]="fixture.defaultSelected" /> </div> `,})export class FileTreeDemoComponent { protected readonly fixture = fileTreeFixture;} export default FileTreeDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> const fileTreeFixture = { id: "file-tree", repo: "ledger-api", nodes: [ { name: "src", defaultOpen: true, children: [ { name: "charge.ts", git: "M" as const }, { name: "ledger.ts" }, ], }, { name: "README.md" }, ], defaultSelected: "/src/charge.ts", }; import { FileTree } from "@grassroot/ui-svelte";</script> <div> <FileTree nodes={fileTreeFixture.nodes} repo={fileTreeFixture.repo} defaultSelected={fileTreeFixture.defaultSelected} /></div>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */const fileTreeFixture = { id: "file-tree", repo: "ledger-api", nodes: [ { name: "src", defaultOpen: true, children: [ { name: "charge.ts", git: "M" as const }, { name: "ledger.ts" }, ], }, { name: "README.md" }, ], defaultSelected: "/src/charge.ts",}; import { FileTree } from "@grassroot/ui-solid"; export default function FileTreeDemo() { return ( <div> <FileTree nodes={fileTreeFixture.nodes} repo={fileTreeFixture.repo} defaultSelected={fileTreeFixture.defaultSelected} /> </div> );}Installation
API Reference
Import
import { FileTree } from "@grassroot/ui-react/advanced";
Props
Prop
Type
Default
Requirement
nodesTreeNode[]—
required
repostring | undefined—
optional
selectedstring | undefined—
optional
defaultSelectedstring | undefined—
optional
onSelect((path: string) => void) | undefined—
optional
- Prop
repo- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
selected- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
defaultSelected- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
onSelect- Type
((path: string) => void) | undefined- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onSelect | ((path: string) => void) | undefined |
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { FileTree } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
nodesFileTreeNode[]—
required
repostring | undefined"project"optional
selectedstring | undefined—
optional
defaultSelectedstring | undefined—
optional
classNamestring | undefined—
optional
- Prop
nodes- Type
FileTreeNode[]- Default
- —
- Requirement
- required
- Prop
repo- Type
string | undefined- Default
"project"- Requirement
- optional
- Prop
selected- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
defaultSelected- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
select | [path: string] |
Import
import { Component } from "@angular/core";
import { GrassrootFileTree } from "@grassroot/ui-angular";
Props
Prop
Type
Default
Requirement
classNamestring—
optional
nodesreadonly FileTreeNode[]—
required
repostring"project"optional
selectedstring—
optional
defaultSelectedstring—
optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
- Prop
nodes- Type
readonly FileTreeNode[]- Default
- —
- Requirement
- required
- Prop
repo- Type
string- Default
"project"- Requirement
- optional
- Prop
selected- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultSelected- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
selectedChange | string |
Import
import { FileTree } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
nodesFileTreeNode[]—
required
repostring"project"optional
selectedstring—
optional
defaultSelectedstring—
optional
onSelect(path: string) => void—
optional
classNamestring—
optional
- Prop
nodes- Type
FileTreeNode[]- Default
- —
- Requirement
- required
- Prop
repo- Type
string- Default
"project"- Requirement
- optional
- Prop
selected- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultSelected- Type
string- Default
- —
- Requirement
- optional
- Prop
onSelect- Type
(path: string) => void- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onSelect | (path: string) => void |
Import
import { FileTree } from "@grassroot/ui-solid";
Props
Prop
Type
Default
Requirement
nodesFileTreeNode[]—
required
repostring"project"optional
selectedstring—
optional
defaultSelectedstring—
optional
onSelect(path: string) => void—
optional
classNamestring—
optional
- Prop
nodes- Type
FileTreeNode[]- Default
- —
- Requirement
- required
- Prop
repo- Type
string- Default
"project"- Requirement
- optional
- Prop
selected- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultSelected- Type
string- Default
- —
- Requirement
- optional
- Prop
onSelect- Type
(path: string) => void- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onSelect | (path: string) => void |