docfx/docs/getting-started.md
Paste these commands into your favorite terminal on Windows, Mac, or Linux. This will install the Terminal.Gui.Templates, create a new "Hello World" TUI app, and run it.
(Press Esc to exit the app)
dotnet new install [email protected].*
dotnet new tui-simple -n myproj
cd myproj
dotnet run
To install Terminal.Gui from Nuget into a .NET Core project, use the dotnet CLI tool with this command.
dotnet add package Terminal.Gui
Use the Terminal.Gui.Templates:
dotnet new install [email protected].*
The following example shows a basic Terminal.Gui application using the modern instance-based model:
using Terminal.Gui.App;
using Terminal.Gui.ViewBase;
using Terminal.Gui.Views;
using IApplication app = Application.Create ();
app.Init ();
using Window window = new () { Title = "Hello World (Esc to quit)" };
Label label = new ()
{
Text = "Hello, Terminal.Gui v2!",
X = Pos.Center (),
Y = Pos.Center ()
};
window.Add (label);
app.Run (window);
Run<T>()app.Run<ExampleWindow>() to run a window that implements xref:Terminal.Gui.App.IRunnableapp.Dispose() to clean up resources and restore the terminalAccept evente.Handled = true in event handlers to prevent further processingWhen run the application looks as follows:
dotnet build in the root directory). Run UICatalog with dotnet run --project UICatalog.Terminal.slnx with Visual Studio 2022 (17.10+).