YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Three Ways to Define a TreeView: Markup (Progressive Enhancement), Existing TreeView Instance, and Object Literal

In this simple example you can see how to build TreeView Control from existing HTML markup and from a previous tree definition or from a branch of it.

Tree from markup

 List 0
 List 0-0
 item 0-0-0
 List 1

Copy of the tree above taken from its own definition

 List 0
 List 0-0
 item 0-0-0
 List 1

Copy of the second branch of the tree at the top

 List 1

Tree built from a static definition

 Label 0
 text label 1
 branch 1
 Label 1-0
 branch 3