TreeView

A tree sidebar for navigating directory structures. Folders are loaded lazily on expand and the active path is highlighted automatically.

Usage

API

Props

PropTypeDefaultDescription
listFilesFunction-Async function (path) => Promise<Array> that returns directory entries. The component filters for isDirectory items only.
activePathString"/"Currently active directory path. The matching node is highlighted and ancestor nodes auto-expand.
fallbackIconString""Fallback icon URL for folders
rootLabelString"/"Label for the root tree node
expandRootBooleantrueAutomatically expand the root node on mount

Events

EventPayloadDescription
navigate{ path: String }Emitted when a folder node is clicked. Use this to update your main view or router.

listFiles Entry Properties

PropertyTypeRequiredDescription
name / fileNameStringYesDisplay name of the entry
isDirectoryBooleanYesWhether the entry is a directory (only directories are shown)
iconStringNoIcon URL for the entry