This page walks you through building a minimal but complete Terminality application. You will import the module, create aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Rikitav/Terminality/llms.txt
Use this file to discover all available pages before exploring further.
StackPanel with a centered label and an exit button, hand the widget tree to HostApplication, and run the UI loop. By the end you will have a working terminal UI and understand the pattern used in every Terminality application.
Complete the installation steps before starting. You need Terminality built and linked into your project.
Build your first app
Import the module and open the namespace
Terminality ships as a C++23 named module. Add these two lines at the top of your source file — no headers required.The single
import terminality; statement makes the entire public API available: all controls, the layout engine, the event system, and HostApplication.Enter the terminal
Inside
main, retrieve the HostApplication singleton and call EnterTerminal(). This switches the terminal into raw input mode and takes over the output buffer.Compose the widget tree
Use the The
init<T>() factory helper to build controls. Pass a lambda that receives a typed pointer to the new control and configures its properties. Nest calls to build a hierarchy.StackPanel stretches to fill the screen. The Label centres itself within the available space. The Button subscribes to the Clicked event and calls RequestStop() to signal the UI loop to exit.Complete example
Here is the full program in one block, ready to compile:What just happened
HostApplication::Current() returns the singleton that owns the terminal lifecycle. It is the single entry and exit point for every Terminality program.
EnterTerminal() puts the terminal into raw mode and sets up the output buffer. From this point, Terminality controls all output; do not write to stdout or stderr directly while the UI loop is running.
init<T>(lambda) allocates a control of type T, calls the lambda with a typed pointer so you can configure properties inline, and returns a std::unique_ptr<T>. This pattern replaces constructors and separate setter calls with a single self-contained expression.
AddChild() on a container control registers a child widget. The layout engine measures and arranges children automatically on every frame based on their alignment and the available space.
btn->Clicked += []() { ... } subscribes a lambda to the Clicked event. Terminality’s event system is type-safe: each event carries its own signature, and subscribers are stored as std::function instances.
RunUILoop(std::move(root)) takes ownership of the root widget, then runs the measure-arrange-render and input-poll loop until RequestStop() is called.
Next steps
Build and integrate
Set up the CMake build and link Terminality into your own project.
What is Terminality?
Understand the architecture, module system, and extension points in depth.