Skip to content zachleat Project

🚾Web Component Star Search

A searchable catalog of standalone web components.

<vaadin-grid-tree-toggle>

`<vaadin-grid-tree-toggle>` is a helper element for the `<vaadin-grid>` that provides toggle and level display functionality for the item tree.

Category
Layout
Built with
Lit
Library
Vaadin
Author
Vaadin
Package
@vaadin/grid
Component size
1.5 kB JS (minified + gzipped, JS includes dependencies beyond the library)
Library size
19.9 kB JS (shared by every Vaadin component, loaded once per page)
Popular
4 out of 5
Downloads
288,102/week · jsDelivr 9,088 hits/month (whole @vaadin/grid package)
Latest stable version
25.3.2
Last published
Component last changed
(in 25.0.0)
License
Apache-2.0

<vaadin-grid-tree-toggle> is a helper element for the <vaadin-grid> that provides toggle and level display functionality for the item tree.

Example:

<vaadin-grid-column id="column"></vaadin-grid-column>
const column = document.querySelector('#column');
column.renderer = (root, column, model) => {
  let treeToggle = root.firstElementChild;
  if (!treeToggle) {
    treeToggle = document.createElement('vaadin-grid-tree-toggle');
    treeToggle.addEventListener('expanded-changed', () => { ... });
    root.appendChild(treeToggle);
  }
  treeToggle.leaf = !model.item.hasChildren;
  treeToggle.level = level;
  treeToggle.expanded = expanded;
  treeToggle.textContent = model.item.name;
};

Styling

The following shadow DOM parts are available for styling:

Part name Description
toggle The tree toggle icon

The following state attributes are available for styling:

Attribute Description
expanded When present, the toggle is expanded
leaf When present, the toggle is not expandable, i. e., the current item is a leaf

The following custom CSS properties are available for styling:

Custom CSS property
--vaadin-grid-tree-toggle-level-offset

See Styling Components documentation.

Attributes

Events