Epicenter
Local-first, open source apps
File Tree is the files the agent changed, shown as folders you can open. A folder is a Collapsible. A file is a Button. For a single file the agent read or edited, use a Tool line instead.
Installation
File Tree is built with the Collapsible and Button components.
Usage
Render nodes recursively. Nest each folder's children in its Collapsible.Content.
{#if node.type === "folder"}
<Collapsible.Root open class="group/folder">
<Collapsible.Trigger>
{#snippet child({ props })}
<Button
{...props}
variant="ghost"
size="sm"
class="w-full justify-start"
>
<ChevronRightIcon
class="transition-transform group-data-[state=open]/folder:rotate-90"
/>
<FolderIcon />
{node.name}
</Button>
{/snippet}
</Collapsible.Trigger>
<Collapsible.Content>
<div class="ml-4 flex flex-col">
{#each node.children as child (child.path)}
<FileTreeNode node={child} />
{/each}
</div>
</Collapsible.Content>
</Collapsible.Root>
{/if} <Button
variant="ghost"
size="sm"
class="w-full justify-start"
onclick={() => onSelect(node.path)}
>
<FileIcon />
{node.name}
</Button> See Collapsible.