CodeExplorer
Read-only source browser with file search, breadcrumbs, and a Monaco preview.
On this page
Props
| Prop | Type | Default | Description |
|---|---|---|---|
files required | readonly CodeExplorerFile[] | None | File metadata, as { path, size? } with paths relative to the source root |
path | string | None | The selected file or directory, relative to the source root |
file required | ResourceReference | None | Resource reference that reads one file. The component adds the selected path to its input. |
basePath required | string | None | Relative host navigation prefix. Each path segment is URL encoded. |
title | string | None | Title shown above the browser |
version | string | None | Changing it refetches the selected file |
emptyMessage | string | None | Text shown when there are no files |
Example
ts
CodeExplorer({
title: "Project source",
files: [{ path: "src/index.ts", size: 120 }],
path: params.path,
basePath: "source/files",
file: { resourceId: "source-file", input: { projectId } },
version: snapshotVersion,
})Supporting types
CodeExplorerFile
export interface CodeExplorerFile {
path: string;
size?: number;
}CodeExplorerContent
export interface CodeExplorerContent {
content?: string | null;
size?: number;
reason?: string | null;
language?: string | null;
}