# RTXUI > RTXUI is a C++23 library for terminal user interfaces. A component is a C++ > class whose HTML template and CSS live in a string member; bound members are > interpolated with `{name}`, and the interface updates when they change. Before writing RTXUI code, read "Common Mistakes": RTXUI templates are not Vue or React. `{}` holds a bound name, never an expression; conditions and loops use `if="{name}"` and ``; handlers are `onclick="Method"`; CSS lengths are terminal cells. Run an app with `RTXUI_STRICT=1` to fail on anything RTXUI would silently ignore, and with `RTXUI_HEADLESS=80x24` to print its screen as text. --- # Getting Started This page covers what you need to build RTXUI, how to add it to a CMake project, and how to build the repository itself. ## Requirements - **A C++23 compiler.** C++23 is required to build and use RTXUI. If available, C++26 enables reflection, which avoids having to bind C++ members manually. - **Linux or macOS.** The terminal backend requires POSIX termios and `SIGWINCH`. Windows is not supported (no ConPTY backend); CMake terminates configuration on Windows platforms with an explicit error. RTXUI also targets the browser through Emscripten / WebAssembly. - **CMake 3.24 or newer.** - **Ninja** (optional, faster builds than Make). On Debian or Ubuntu: ```bash sudo apt install cmake ninja-build g++-14 ``` Select the compiler per build rather than changing system defaults — pass it to CMake explicitly: ```bash CC=gcc-14 CXX=g++-14 cmake -B build -G Ninja ``` (For Clang, install it from your distribution or [apt.llvm.org](https://apt.llvm.org) and set `CC=clang CXX=clang++` the same way.) ## Adding RTXUI to your project ### With FetchContent The simplest integration downloads RTXUI at configure time: ```cmake cmake_minimum_required(VERSION 3.24) project(my_app LANGUAGES CXX) set(CMAKE_CXX_STANDARD 23) # Use 26 to enable automatic static reflection. set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) include(FetchContent) FetchContent_Declare( rtxui GIT_REPOSITORY https://github.com/ArthurSonzogni/RTXUI.git GIT_TAG main # Pin a tag or commit for reproducible builds. ) FetchContent_MakeAvailable(rtxui) add_executable(my_app main.cpp) target_link_libraries(my_app PRIVATE rtxui) ``` Link against the **`rtxui`** target, not `rtxui_lib`. Built-in elements register themselves through static initializers, and the `rtxui` target carries the linker flags that keep those initializers from being discarded. Linking `rtxui_lib` directly can produce binaries where tags like ` ``` ### `@` shorthand (`@click`, `@change`) The `@` prefix is equivalent: ```html ``` --- ## 3. Event Modifiers To intercept specific mouse behaviors (like context menu clicks), you can append a modifier suffix: ```html ``` * `@click` or `@click.left`: Main trigger callback. * `@click.right`: Secondary/context menu trigger. --- ## 4. Parameterized Callbacks Callbacks can accept arguments from templates. The arguments are received by the C++ lambda as `std::string` parameters. This is extremely useful for index tracking in loops: ```cpp // Registered in constructor Import("RemoveItem", [this](std::string index_str) { size_t index = std::stoull(index_str); items.erase(items.begin() + index); }); ``` To invoke a parameterized callback in a template, pass a value or an interpolated loop variable in parentheses. Inside a [`` loop](/guide/loops), `{$index}` interpolates to the current item's index: ```html ``` --- ## 5. Two-Way Data Binding For interactive input widgets, RTXUI supports automatic two-way data bindings. When a user types text or checks a box, the bound C++ member variable is updated instantly, and programmatically changing the C++ value repaints the input field: * **`` / `