Tree
<vscode-tree>
Properties
- arrows reflected
Attribute arrows Type boolean
Default false
- data
Attribute data Type TreeItem[]
- indent
Attribute indent Type number
Default 8
- indentGuides reflected
Attribute indent-guides Type boolean
Default false
- multiline reflected
Attribute multiline Type boolean
Default false
- tabindex reflected
Attribute tabindex Type number
Default 0
- version readonly
VSC Element version
Methods
- closeAll
Closes all opened tree items recursively.
Return void
- deselectAll
Deselects all selected items.
- getItemByPath
Returns a reference to a TreeItem object by path.
Parameters [object Object]
Events
- vsc-run-action deprecated
Renamed to
vsc-tree-action
Dispatched when an action icon is clicked.
Type CustomEvent
- vsc-select deprecated
Renamed to
vsc-tree-select
Dispatched when an item is selected.
Type CustomEvent
- vsc-tree-action
Dispatched when an action icon is clicked.
Type VscTreeActionEvent
- vsc-tree-select
Dispatched when an item is selected.
Type CustomEvent
Custom CSS Properties
--vscode-focusBorder
--vscode-font-family
--vscode-font-size
--vscode-font-weight
--vscode-list-activeSelectionBackground
--vscode-list-activeSelectionForeground
--vscode-list-focusOutline
--vscode-list-hoverBackground
--vscode-list-hoverForeground
--vscode-list-inactiveFocusBackground
--vscode-list-inactiveFocusOutline
--vscode-list-inactiveSelectionBackground
--vscode-list-inactiveSelectionForeground
--vscode-list-inactiveSelectionIconForeground
--vscode-tree-inactiveIndentGuidesStroke
--vscode-tree-indentGuidesStroke
CSS Parts
- decorations
Container of decorations
counter-badge-decoration
description
filled-circle-decoration
text-content
Custom types
type IconVariant = 'branch' | 'leaf' | 'open';
export interface TreeItemIconConfig {
branch?: string;
open?: string;
leaf?: string;
}
/** Action icon configuration. */
export interface TreeItemAction {
/** A unique name that identifies the clicked action item. */
actionId: string;
/** A Codicon name. */
icon: string;
/** Text description of the action. */
tooltip?: string;
}
/**
* The decoration is additional content on the right side of the tree item. It can be a short text,
* a counter, or a small, filled circle. A color can be defined for the different states. If
* multiple states are applied to the item, the color with higher precedence will be used. The color
* precedence from higher to lower is selected, focused, hover, normal. Colors will not be applied
* to the counter badge.
*/
export interface TreeItemDecoration {
/** Text content of the decoration. If the appearance is `filled-circle`, it will be ignored. */
content?: string;
/** Appearance of the decoration. */
appearance?: 'text' | 'counter-badge' | 'filled-circle';
/**
* When is decoration visible?
* - `active`: visible when the tree item is focused, selected or hovered
* - `normal`: visible when there is not any interaction on the tree item
* - `always`: always visible
*/
visibleWhen?: 'active' | 'normal' | 'always';
/** A valid CSS property value to define a default color. */
color?: string;
/** A valid CSS property value to define the color for the mouse over state. */
hoverColor?: string;
/** A valid CSS property value to define the color for the focused state. */
focusedColor?: string;
/** A valid CSS property value to define the color for the selected state. */
selectedColor?: string;
}
export interface TreeItem {
label: string;
description?: string;
tooltip?: string;
subItems?: TreeItem[];
actions?: TreeItemAction[];
open?: boolean;
selected?: boolean;
focused?: boolean;
hasSelectedItem?: boolean;
hasFocusedItem?: boolean;
icons?: TreeItemIconConfig | boolean;
iconUrls?: TreeItemIconConfig;
value?: string;
path?: number[];
decorations?: TreeItemDecoration[];
}
type ItemType = 'branch' | 'leaf';
/** Event payload of the `vsc-select` event. */
interface SelectEventDetail {
/** Icon configuration of the clicked item */
icons: TreeItemIconConfig | undefined | boolean;
/** Is item type branch or leaf. */
itemType: ItemType;
/** The visible label of the item. */
label: string;
/** The value associated to the item. */
value: string;
/** Is the item opened if it's a branch. */
open: boolean;
/** Path represents the item place in the tree. For example 1/2/3 means:
* `data[1].subItems[2].subItems[3]` */
path: string; // ex.: 0/0/1
}