Intro:-
Layout class represents a renderable to divide a fixed height into rows or columns.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 cliapplayout
Install Nuget Package:-
>dotnet add package Spectre.Console
Create Object:-
var layout = new Layout("Root")
Split Columns:-
new Layout("Left")
Split Rows:-
new Layout("Top Layout")
Set Ratio and Size:-
layout["Left"].Ratio(6);
layout["Right"].Size(42);
Set Visibility:-
layout["Left"].Visible();
Render the layout on Console:-
AnsiConsole.Write(layout);
Conclusion:-
To create a layout, create object then split the Columns and Rows. Give Ratio and Size according to app requirement. Call Visible(), and Render the layout on Console. The full source code is on GitHub.