# How to create tree based terminal app in .net core

### Intro:-

Tree is used to render hierarchical data on the terminal. Spectre.Console is a .NET library which is used to create console applications. Spectre.Console is rendering the tree on the terminal.

### Steps:-

### Create Project:-

`>dotnet new console -o cliapptree`

### Install Nuget Package:-

`>dotnet add package Spectre.Console`

### Create object:-

`var root = new Tree("[darkorange3_1]Root[/]")`

### Add some nodes:-

`var foo = root.AddNode("[magenta]Tree[/]");`

### Add calendar events:-

```plaintext
AddCalendarEvent(2023, 12, 12)
    .HideHeader()
    .BorderStyle(Style.Parse("Magenta3")));
```

### Render the tree on Console:-

`AnsiConsole.Write(root);`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1676097933008/b9b5a8b9-bf7e-4bf0-ab31-538fbc5832c2.png align="center")

### Conclusion:-

To render a Tree, create a tree object, and add some styling code according to the app's requirements. Complete the app by passing the tree-dependent calendar to a console's Write method. The full source code is on GitHub.

The app is updated to dotnet 6 version from v3.1 also updated to spectreconsole version 0.47.0

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1693652391638/ef7a8675-173d-40f7-816f-e9e1f2e43e61.png align="center")
