https://github.com/migueldeicaza/gui.cs Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} migueldeicaza / gui.cs Public * Notifications * Fork 520 * Star 6.3k Console-based user interface toolkit for .NET applications. License MIT license 6.3k stars 520 forks Star Notifications * Code * Issues 71 * Pull requests 8 * Discussions * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Projects * Wiki * Security * Insights This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 28 branches 45 tags Code Latest commit @tig tig Release v1.6.0 (#1722) ... cc04bb3 May 26, 2022 Release v1.6.0 (#1722) * Change log for Release v1.6.0 * Regenerated API docs for v1.6.0 * Merged #1724 * Relnotes update * Fixed minor issues in readme * Updated changelog * New sample.gif for README.md * Ignore demo artifacts cc04bb3 Git stats * 2,607 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .devcontainer Upgrading to Net6.0 (#1515) Dec 18, 2021 .github Bump github/codeql-action from 1 to 2 Apr 25, 2022 Example Fixes #1693 (Charmap wide runes) by upgrading to Nstack.core 0.17 (# 1718 May 26, 2022 FSharpExample Upgrading to Net6.0 (#1515) Dec 18, 2021 ReactiveExample Bump ReactiveUI.Fody from 17.1.17 to 18.0.10 Apr 27, 2022 StandaloneExample Standalone update fix (#1596) Feb 18, 2022 Terminal.Gui Release v1.6.0 (#1722) May 26, 2022 UICatalog Release v1.6.0 (#1722) May 26, 2022 UnitTests Fix thin tabview (#1737) May 21, 2022 docfx Release v1.6.0 (#1722) May 26, 2022 docs Regenerated API docs for v1.6.0 (#1721) May 14, 2022 .editorconfig Mouse events menu (#401) Apr 20, 2020 .gitattributes Forces the height of the TextField to 1 which is just the valid heigh... Apr 20, 2020 .gitignore Release v1.6.0 (#1722) May 26, 2022 CODE_OF_CONDUCT.md added contribution guidelines, project layout docs, etc... May 28, 2020 CONTRIBUTING.md Version 1.0 (#1227) Apr 28, 2021 LICENSE Add Jan 6, 2018 README.md Release v1.6.0 (#1722) May 26, 2022 Terminal.sln Makes it easier to use a local NStack.Core package (#1740) May 26, 2022 global.json Upgrading to Net6.0 (#1515) Dec 18, 2021 packages.config All my pull-request at once (#345) Mar 31, 2020 View code [ ] Terminal.Gui - Cross Platform Terminal UI toolkit for .NET Controls and Views Features Keyboard Input Handling Driver Model Showcase & Examples Documentation Sample Usage Installing Installation in .NET Core Projects Running and Building Contributing History README.md .NET Core Code scanning - action Version Code Coverage Downloads License Bugs Terminal.Gui - Cross Platform Terminal UI toolkit for .NET A toolkit for building rich console apps for .NET, .NET Core, and Mono that works on Windows, the Mac, and Linux/Unix. Sample app Controls and Views Terminal.Gui provides a rich set of views and controls for building terminal user interfaces: * Button * CheckBox * ColorPicker * ComboBox * Dialog + OpenDialog + SaveDialog * FrameView * GraphView * Hex viewer/editor * Label * ListView * Menu * MessageBox * ProgressBar * Radio buttons * TableView * Time & Date Fields * TextField * TextValidateField * TextView (Text Editor) * TreeView * ScrollView * ScrollBarView * StatusBar * Window Features * Cross Platform - Windows, Mac, and Linux. Terminal drivers for Curses, Windows Console, and the .NET Console mean apps will work well on both color and monochrome terminals. * Keyboard and Mouse Input - Both keyboard and mouse input are supported, including support for drag & drop. * Flexible Layout - Supports both Absolute layout and an innovative Computed Layout system. Computed Layout makes it easy to layout controls relative to each other and enables dynamic terminal UIs. * Clipboard support - Cut, Copy, and Paste of text provided through the Clipboard class. * Arbitrary Views - All visible UI elements are subclasses of the View class, and these in turn can contain an arbitrary number of sub-views. * Advanced App Features - The Mainloop supports processing events, idle handlers, timers, and monitoring file descriptors. Most classes are safe for threading. * Reactive Extensions - Use reactive extensions and benefit from increased code readability, and the ability to apply the MVVM pattern and ReactiveUI data bindings. See the source code of a sample app in order to learn how to achieve this. Keyboard Input Handling Terminal.Gui respects common Linux, Mac, and Windows keyboard idioms. For example, clipboard operations use the familiar Control/Command-C, X, V model. CTRL-Q is used for exiting views (and apps). The input handling of Terminal.Gui is similar in some ways to Emacs and the Midnight Commander, so you can expect some of the special key combinations to be active. The key ESC can act as an Alt modifier (or Meta in Emacs parlance), to allow input on terminals that do not have an alt key. So to produce the sequence Alt-F, you can press either Alt-F, or ESC followed by the key F. To enter the key ESC, you can either press ESC and wait 100 milliseconds, or you can press ESC twice. ESC-0, and ESC-1 through ESC-9 have a special meaning, they map to F10, and F1 to F9 respectively. Apps can change key bindings using the AddKeyBinding API. Driver Model Terminal.Gui has support for ncurses, System.Console, and a full Win32 Console front-end. ncurses is used on Mac/Linux/Unix with color support based on what your library is compiled with; the Windows driver supports full color and mouse, and an easy-to-debug System.Console can be used on Windows and Unix, but lacks mouse support. You can force the use of System.Console on Unix as well; see Core.cs. Showcase & Examples * UI Catalog - The UI Catalog project provides an easy to use and extend sample illustrating the capabilities of Terminal.Gui. Run dotnet run --project UICatalog to run the UI Catalog. * Reactive Example - A sample app that shows how to use System.Reactive and ReactiveUI with Terminal.Gui. The app uses the MVVM architecture that may seem familiar to folks coming from WPF, Xamarin Forms, UWP, Avalonia, or Windows Forms. In this app, we implement the data bindings using ReactiveUI WhenAnyValue syntax and Pharmacist -- a tool that converts all events in a NuGet package into observable wrappers. * Example (aka demo.cs) - Run dotnet run in the Example directory to run the simple demo. * Standalone Example - A trivial .NET core sample application can be found in the StandaloneExample directory. Run dotnet run in directory to test. * F# Example - An example showing how to build a Terminal.Gui app using F#. * PowerShell's Out-ConsoleGridView - OCGV sends the output from a command to an interactive table. * PoshRedisViewer - A compact Redis viewer module for PowerShell written in F# and Gui.cs Documentation * Overview * Conceptual Documentation * API Documentation See the Terminal.Gui/ README for an overview of how the library is structured. The Conceptual Documentation provides insight into core concepts. Sample Usage (This code uses C# 9.0 Top-level statements.) using Terminal.Gui; using NStack; Application.Init(); var top = Application.Top; // Creates the top-level window to show var win = new Window("MyApp") { X = 0, Y = 1, // Leave one row for the toplevel menu // By using Dim.Fill(), it will automatically resize without manual intervention Width = Dim.Fill(), Height = Dim.Fill() }; top.Add(win); // Creates a menubar, the item "New" has a help menu. var menu = new MenuBar(new MenuBarItem[] { new MenuBarItem ("_File", new MenuItem [] { new MenuItem ("_New", "Creates new file", null), new MenuItem ("_Close", "",null), new MenuItem ("_Quit", "", () => { if (Quit ()) top.Running = false; }) }), new MenuBarItem ("_Edit", new MenuItem [] { new MenuItem ("_Copy", "", null), new MenuItem ("C_ut", "", null), new MenuItem ("_Paste", "", null) }) }); top.Add(menu); static bool Quit() { var n = MessageBox.Query(50, 7, "Quit Demo", "Are you sure you want to quit this demo?", "Yes", "No"); return n == 0; } var login = new Label("Login: ") { X = 3, Y = 2 }; var password = new Label("Password: ") { X = Pos.Left(login), Y = Pos.Top(login) + 1 }; var loginText = new TextField("") { X = Pos.Right(password), Y = Pos.Top(login), Width = 40 }; var passText = new TextField("") { Secret = true, X = Pos.Left(loginText), Y = Pos.Top(password), Width = Dim.Width(loginText) }; // Add some controls, win.Add( // The ones with my favorite layout system, Computed login, password, loginText, passText, // The ones laid out like an australopithecus, with Absolute positions: new CheckBox(3, 6, "Remember me"), new RadioGroup(3, 8, new ustring[] { "_Personal", "_Company" }, 0), new Button(3, 14, "Ok"), new Button(10, 14, "Cancel"), new Label(3, 18, "Press F9 or ESC plus 9 to activate the menubar") ); Application.Run(); Application.Shutdown(); The example above shows adding views using both styles of layout supported by Terminal.Gui: Absolute layout and Computed layout. Alternatively, you can encapsulate the app behavior in a new Window-derived class, say App.cs containing the code above, and simplify your Main method to: using Terminal.Gui; class Demo { static void Main () { Application.Run (); Application.Shutdown (); } } Installing Use NuGet to install the Terminal.Gui NuGet package: https:// www.nuget.org/packages/Terminal.Gui Installation in .NET Core Projects To install Terminal.Gui into a .NET Core project, use the dotnet CLI tool with following command. dotnet add package Terminal.Gui Running and Building * Windows, Mac, and Linux - Build and run using the .NET SDK command line tools (dotnet build in the root directory). Run UICatalog with dotnet run --project UICatalog. * Windows - Open Terminal.Gui.sln with Visual Studio 2019. Building in Release requires the git command line tool (a dependency of the MinVer build tool) Contributing See CONTRIBUTING.md. Debates on architecture and design can be found in Issues tagged with design. History This is an updated version of gui.cs that Miguel wrote for mono-curses in 2007. The original gui.cs was a UI toolkit in a single file and tied to curses. This version tries to be console-agnostic and instead of having a container/widget model, only uses Views (which can contain subviews) and changes the rendering model to rely on damage regions instead of burdening each view with the details. A presentation of this was part of the Retro.NET talk at .NET Conf 2018 Slides Release history can be found in the Terminal.Gui.csproj file. In 2019, 2020, and 2021, Charlie Kindel (https://github.com/tig), @BDisp (https://github.com/BDisp), and Thomas Nind (https:// github.com/tznind) vastly extended, improved, polished and fixed gui.cs to what it is today. About Console-based user interface toolkit for .NET applications. Topics gui terminal csharp toolkit dotnet curses Resources Readme License MIT license Code of conduct Code of conduct Stars 6.3k stars Watchers 140 watching Forks 520 forks Releases 8 Release v1.6.0 Latest May 26, 2022 + 7 releases Packages 0 No packages published Used by 681 * @GitHababi * @austinread * @wgross * @Lutonet * @karenpayneoregon * @wisejnrs * @junqy * @OlivierMiracle + 673 Contributors 80 * @tig * @BDisp * @tznind * @migueldeicaza * @fergusonr * @dependabot[bot] * @worldbeater * @daltskin * @kzu * @Mgamerz * @Martin4ndersen + 69 contributors Languages * C# 99.2% * Other 0.8% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.