Skip to content
VSCode Elements

Tree

Tag name: <vscode-tree>

Properties

expandMode
NameexpandMode
Attributeexpand-mode
Type

'singleClick' | 'doubleClick'

Default

'singleClick'

Description

Controls how tree folders are expanded when clicked. This property is designed to use the workbench.tree.expandMode setting.

Valid options are available as constants.

import {ExpandMode} from '@vscode-elements/elements/dist/vscode-tree/vscode-tree.js';

document.querySelector('vscode-tree').expandMode = ExpandMode.singleClick;
hideArrowsreflects
NamehideArrows
Attributehide-arrows
Type

boolean

Default

false

Description

Although arrows are always visible in the Tree component by default in VSCode, some icon sets (e.g., Material Icon Theme) allow disabling them in the file explorer view. This flag makes it possible to mimic that behavior.

indentreflects
Nameindent
Attributeindent
Type

number

Default

8

Description

Controls the indentation in pixels. This property is designed to use the workbench.tree.indent setting.

indentGuidesreflects
NameindentGuides
Attributeindent-guides
Type

'none' | 'onHover' | 'always'

Default

'onHover'

Description

Controls whether the tree should render indent guides. This property is designed to use the workbench.tree.renderIndentGuides setting.

Valid options are available as constants.

import {IndentGuides} from '@vscode-elements/elements/dist/vscode-tree/vscode-tree.js';

document.querySelector('vscode-tree').expandMode = IndentGuides.onHover;
multiSelectreflects
NamemultiSelect
Attributemulti-select
Type

boolean

Default

false

Description

Allows selecting multiple items.

versionreadonly
Nameversion
Type

string

Description

VSCode Elements version

Methods

collapseAll()
NamecollapseAll
Description

Collapses all folders.

expandAll()
NameexpandAll
Description

Expands all folders.

CSS Custom Properties

--vscode-font-family
Name--vscode-font-family
Default valuesans-serif
--vscode-font-size
Name--vscode-font-size
Default value13px
--vscode-font-weight
Name--vscode-font-weight
Default valuenormal
--vscode-foreground
Name--vscode-foreground
Default value#cccccc
--vscode-icon-foreground
Name--vscode-icon-foreground
Default value#cccccc
--vscode-list-focusAndSelectionOutline
Name--vscode-list-focusAndSelectionOutline
Default value#0078d4
--vscode-list-focusOutline
Name--vscode-list-focusOutline
Default value#0078d4
--vscode-list-hoverBackground
Name--vscode-list-hoverBackground
Default value#2a2d2e
--vscode-list-hoverForeground
Name--vscode-list-hoverForeground
Default value#cccccc
--vscode-tree-inactiveIndentGuidesStroke
Name--vscode-tree-inactiveIndentGuidesStroke
Default valuergba(88, 88, 88, 0.4)
--vscode-tree-indentGuidesStroke
Name--vscode-tree-indentGuidesStroke
Default value#585858