mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-18 21:08:15 +08:00
Add layout documentation
This commit is contained in:

committed by
Patrik Svensson

parent
bc6ba26840
commit
eba2a8cc76
@ -0,0 +1,30 @@
|
||||
using Spectre.Console;
|
||||
using Spectre.Console.Json;
|
||||
|
||||
namespace Generator.Commands.Samples
|
||||
{
|
||||
public class LayoutSample : BaseSample
|
||||
{
|
||||
public override (int Cols, int Rows) ConsoleSize => (80, 24);
|
||||
|
||||
public override void Run(IAnsiConsole console)
|
||||
{
|
||||
var layout = new Layout("Root")
|
||||
.SplitColumns(
|
||||
new Layout("Left"),
|
||||
new Layout("Right")
|
||||
.SplitRows(
|
||||
new Layout("Top"),
|
||||
new Layout("Bottom")));
|
||||
|
||||
layout["Left"].Update(
|
||||
new Panel(
|
||||
Align.Center(
|
||||
new Markup("Hello [blue]World![/]"),
|
||||
VerticalAlignment.Middle))
|
||||
.Expand());
|
||||
|
||||
AnsiConsole.Write(layout);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user