Cogent Core Docs

0%

Loading...

Static preview:

Tree

A tree is a widget that allows you to display a nested tree structure. Users can use context menus and drag-and-drop to add, remove, and move tree nodes (core.Tree).

For filesystem trees, use a file tree instead. For a struct, use a form. For a non-nested slice, use a list. For a map, use a keyed list.

Properties

You can make a tree and add tree child nodes directly to it:

You can make a tree represent another tree.Node tree:

You can prevent users from changing a tree:

Events

You can detect when a user changes the value of a tree:

You can add an initialization function that is called automatically with each tree node (this example adds a context menu):

Styles

You can change the font size of a tree:

You can change the icon size of a tree:

Tree button

You can make a button that opens an interactive inspector of a tree:

/node-base