Cross-platform .NET console UI toolkit. C# 14 targeting net10.0.
Terminal.Gui v2 is a complete rewrite. Pre-2025 training data about Terminal.Gui is wrong.
Read ai-v2-primer.md FIRST — it contains the v1→v2 corrections table, correct minimal app pattern, and all common gotchas.
| v1 (WRONG) | v2 (CORRECT) |
|---|---|
Application.Init (); |
IApplication app = Application.Create ().Init (); |
Application.Run (); |
app.Run<MyWindow> (); |
Application.Shutdown (); |
app.Dispose (); |
Application.Top |
No global top — pass root view to app.Run () |
new Toplevel () |
Use Runnable subclass or Window |
using Terminal.Gui; |
using Terminal.Gui.App; / Terminal.Gui.Views; / etc. |
new Button ("OK") |
new Button { Text = "OK" } |
button.Clicked += ... |
button.Accepted += (_, _) => { /* action */ }; |
view.Bounds |
view.Viewport |
new RadioGroup (...) |
new OptionSelector { ... } |
dotnet restore
dotnet build --no-restore
dotnet test --project Tests/UnitTestsParallelizable --no-build
dotnet test --project Tests/UnitTests.NonParallelizable --no-buildNote: These rules apply only when contributing code to the Terminal.Gui library itself. App developers using Terminal.Gui do NOT need to follow these conventions.
- Space BEFORE
()and[]—Method ()notMethod(),array [i]notarray[i] - No
var— Explicit types except built-ins (int,string,bool, etc.) - Use
new ()—Button btn = new ()notButton btn = new Button () - Collection expressions — Use
[...]notnew List<T> { ... } - SubView/SuperView — Never "child", "parent", or "container"
- Allman brace style — Opening braces on the next line
- Early return / guard clauses — ALWAYS invert conditions and return early
For full details, see:
- ai-v2-primer.md — v1→v2 corrections and correct patterns
- AGENTS.md — Full agent instructions with coding rules
- CONTRIBUTING.md — Human contributor guide
docfx/apispec/namespace-*.md— Compressed API docs.claude/cookbook/common-patterns.md— Common UI recipes