Tree Guide Reference

A complete reference of all tree guide styles available in Spectre.Console

Spectre.Console provides various tree guide styles for rendering hierarchical data structures. Each guide style defines the visual characters used for branches, continuations, and spacing.

Usage Example

var tree = new Tree("Root");
tree.Guide(TreeGuide.Line);
  
var node1 = tree.AddNode("Child 1");
node1.AddNode("Grandchild 1.1");
node1.AddNode("Grandchild 1.2");
  
tree.AddNode("Child 2");
  
AnsiConsole.Write(tree);

Important Notes

  • Unicode Support: Some tree guides use Unicode box-drawing characters. Ensure your terminal supports Unicode.
  • Four Parts: Each guide defines Space, Continue, Fork, and End characters for building tree structures.
  • Custom Guides: You can create custom tree guides by inheriting from TreeGuide and implementing GetPart().

Available Tree Guides

Total tree guide styles available: 4

TreeGuide.Ascii

Root
|-- Child 1
|   |-- Grandchild 1.1
|   `-- Grandchild 1.2
`-- Child 2
    |-- Grandchild 2.1
    `-- Grandchild 2.2

TreeGuide.BoldLine

Root
┣━━ Child 1
┃   ┣━━ Grandchild 1.1
┃   ┗━━ Grandchild 1.2
┗━━ Child 2
    ┣━━ Grandchild 2.1
    ┗━━ Grandchild 2.2

TreeGuide.DoubleLine

Root
╠══ Child 1
║   ╠══ Grandchild 1.1
║   ╚══ Grandchild 1.2
╚══ Child 2
    ╠══ Grandchild 2.1
    ╚══ Grandchild 2.2

TreeGuide.Line

Root
├── Child 1
│   ├── Grandchild 1.1
│   └── Grandchild 1.2
└── Child 2
    ├── Grandchild 2.1
    └── Grandchild 2.2