File Tree

The files the agent changed, shown as folders you can open.

Usage

File Tree

import { NgTemplateOutlet } from '@angular/common';import { Component, ViewEncapsulation, signal } from '@angular/core';import {  ScButton,  ScCollapsible,  ScCollapsiblePanel,  ScCollapsibleTrigger,} from '@semantic-components/ui';import {  SiChevronRightIcon,

A folder is a Collapsible on a ghost Button component; a file is a button, the selected one marked with aria-current. For a single file the agent read or edited, use a Tool line instead. A tree to browse with the arrow keys is the Tree.

Anatomy

The nodes render themselves: an ng-template that outputs itself for a folder's children.

import {  ScCollapsible, ScCollapsibleTrigger, ScCollapsiblePanel, ScButton,} from '@semantic-components/ui';
<ng-template #tree let-node>  @if (node.type === 'folder') {    <div scCollapsible [open]="true">      <button scButton scCollapsibleTrigger variant="ghost" size="sm">        <svg siChevronRightIcon class="in-data-panel-open:rotate-90"></svg>        <svg siFolderIcon></svg>        {{ node.name }}      </button>      <div scCollapsiblePanel>        <div class="ms-4 flex flex-col">          @for (child of node.children; track child.path) {            <ng-container [ngTemplateOutlet]="tree"              [ngTemplateOutletContext]="{ $implicit: child }" />          }        </div>      </div>    </div>  } @else {    <button scButton variant="ghost" size="sm" (click)="select(node.path)">      <svg siFileIcon></svg>      {{ node.name }}    </button>  }</ng-template>

Examples

RTL

import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import {  ScButton,  ScCollapsible,  ScCollapsiblePanel,  ScCollapsibleTrigger,} from '@semantic-components/ui';import {  SiChevronRightIcon,

API reference

See the Collapsible and the Button component.