Directory

← Back

tree

Tree component for Vaadin 24, Vaadin 23 and Vaadin 14

Author

Rating

Popularity

1100+

This is Tree component for Vaadin 14, Vaadin 23 and Vaadin 24, the API mimics the Tree API from Vaadin 8 for applicable parts.

Features

Sample code

        Tree<Department> tree = new Tree<>(Department::getName);

        tree.setItems(departmentData.getRootDepartments(),
                departmentData::getChildDepartments);

        tree.setItemIconProvider(item -> getIcon(item));
        tree.setItemIconSrcProvider(item -> getImageIconSrc(item));
        tree.setItemTitleProvider(Department::getManager);

        tree.addExpandListener(event -> message.setValue(
                String.format("Expanded %s item(s)", event.getItems().size())
                        + "\n" + message.getValue()));
        tree.addCollapseListener(event -> message.setValue(
                String.format("Collapsed %s item(s)", event.getItems().size())
                        + "\n" + message.getValue()));

        tree.asSingleSelect().addValueChangeListener(event -> {
            if (event.getValue() != null)
                System.out.println(event.getValue().getName() + " selected");
        });
        tree.setHeightByRows(true);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Version 3.3.0

  • Add delegate method for scrollToIndex(int...)
  • Add delegate method for setPartNameGenerator
  • Improve keyboard navigation. Space now toggles expand/collapse, Enter toggles selection
  • Vaadin 24.3 or newer is required
Released
2024-07-17
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 24.3
Vaadin 24.4
Vaadin 20 in 2.0.0
Vaadin 19 in 2.0.0
Vaadin 18 in 2.0.0
Vaadin 14 in 1.0.0
Vaadin 22 in 2.2.0
Vaadin 21 in 2.2.0
Vaadin 23 in 2.2.0
Vaadin 24+ in 3.0.0
Browser
Firefox
Opera
Safari
Google Chrome
iOS Browser
Android Browser
Microsoft Edge

tree - Vaadin Add-on Directory

Tree component for Vaadin 24, Vaadin 23 and Vaadin 14 tree - Vaadin Add-on Directory
This is Tree component for Vaadin 14, Vaadin 23 and Vaadin 24, the API mimics the Tree API from Vaadin 8 for applicable parts. Features - Supports VaadinIcons or image icons - Single select / multiselect modes - Programmatic focus - Tooltips - Expand/Collapse by toggle icon only: https://github.com/vaadin/flow-components/issues/1091
Online