Skip to components
DEVELOPER REFERENCE

FileTree API

Props, callbacks and methods. Select an underlined type to explore its fields, allowed values and callback arguments.

FileTree9 props2 callbacks0 methods

Preset and CSS

Set preset.className to attach your CSS class to the component's rendered surface. Explicit component props take precedence over preset options.

CSS parts in the example [data-part="root"]

Use styles.root and styles.parts in a theme and generate a CSS file with themeToCss. For other JSON-friendly component props, spread presetProps(preset) before explicit props. Parts and states depend on configuration; the gallery shows those visible in the current preview.

Props9

FileTree props
NameTypeDescription
labelRequiredstringAccessible name of the file list.
nodesRequired
readonly FileTreeNode[]Inspect type
Files and folders in display order.
valueOptionalstring | undefinedControlled selected path. Use an empty string for no selection.
defaultValueOptionalstring | undefinedInitially selected path when uncontrolled.
expandedOptional
readonly string[] | undefinedInspect type
Controlled list of open folder paths.
defaultExpandedOptional
readonly string[] | undefinedInspect type
Initially open folders. Omit to start with all folders open.
statusLabelsOptional
Partial<Record<FileChangeStatus, { label: string; marker?: string; }>> | undefinedInspect type
Localized accessible status names and optional visible marker letters.
presetOptional
ClassPreset | undefinedInspect type
Optional presentation preset.
classNameOptionalstring | undefinedAdditional root class names.

Events and callbacks2

FileTree events and callbacks
NameTypeDescription
onExpandedChangeOptional
((paths: string[]) => void) | undefinedInspect type
Called with the open folder paths after a folder toggles.
onValueChangeOptional
((path: string) => void) | undefinedInspect type
Called when a file is selected.

Methods0

No component-specific imperative methods. Use props and callbacks to control this component.