Reference Source
import {Tree} from '@adobe/coral-spectrum'
public class | source

Tree

Expression Extends:

class Tree extends BaseComponent(HTMLElement)

Mixin Extends:

HTMLElement, BaseComponent

A Tree component is a container component to display collapsible content. Tree items don't expand by default. It's the developer's responsibility to handle it by listening to the coral-collection:add and coral-collection:remove events.

See:

Example:

Markup
<coral-tree></coral-tree>
JS constructor
new Coral.Tree();

Member Summary

Public Members
public

The Collection Interface that allows interacting with the items that the component contains.

public

Indicates whether the tree accepts multiple selected items.

public

Returns the first selected item in the Tree.

public

Returns an Array containing the set selected items.

Method Summary

Public Methods
public

Collapse all the Tree Items

public

Expand all the Tree Items

Public Members

public items: SelectableCollection source

The Collection Interface that allows interacting with the items that the component contains.

  • read-only

public multiple: Boolean source

Indicates whether the tree accepts multiple selected items.

  • false by default.
  • reflected

public selectedItem: HTMLElement source

Returns the first selected item in the Tree. The value null is returned if no element is selected.

  • read-only

public selectedItems: Array<HTMLElement> source

Returns an Array containing the set selected items.

  • read-only

Public Methods

public collapseAll() source

Collapse all the Tree Items

public expandAll() source

Expand all the Tree Items