RTXUI

A browser engine for your terminal, in C++.
Write the interface in HTML. Style it with real CSS: flexbox, grid, media
queries, transitions, keyframe animations, :hover, :focus. Bind it to
plain C++ members, change a member, and the screen follows. Save the file
and the running app reloads its template, with no recompile.
From the author of FTXUI.
https://github.com/user-attachments/assets/b613896a-814c-4081-91e1-6de5deb7a305
▶ Run this exact app in your browser
·
Read its source (one file)
·
Documentation
The idea
Terminal UI libraries make you lay out boxes by hand, or learn yet another
layout DSL. The web solved layout long ago, and most developers already know
the solution. RTXUI brings it to the terminal, cell for cell:
#include <rtxui/rtxui.hpp>
class Counter : public rtxui::Component<Counter> {
public:
int count = 0;
void Increment() { count++; }
Counter() {
Bind(count);
Bind(Increment);
EnableHotReload(); // Edit the template below while the app runs.
}
std::string_view view = R"html(
<div class="card">
<h1>Count: {count}</h1>
<button onclick="Increment">Increment</button>
</div>
<style>
.card { border: round; border-color: cyan; padding: 1 2; }
h1 { color: yellow; margin-bottom: 1; }
button { border: solid; padding: 0 1; transition: all 0.2s ease; }
button:hover, button:focus { border-color: green; color: green; }
</style>
)html";
};
int main() {
rtxui::Screen screen(rtxui::Ref<Counter>::New());
screen.Loop();
}
That is the whole program. The mouse works, Tab moves focus, the button
fades to green on hover, and the count updates when you click.
What's in the box
https://github.com/user-attachments/assets/10d75224-eb4d-4e71-8d53-2e647028c923
Layout, the way the web does it
- Flexbox, with
gap, wrap, grow/shrink/basis and alignment on both axes.
- Grid:
repeat(auto-fill, minmax(…)), named lines and areas, grid-auto-flow: dense.
position: relative | absolute | fixed | sticky, translate, z-index.
- Scroll containers with real scrollbars,
scroll-behavior: smooth, nested scrolling.
@media (max-width: …) to rearrange the interface as the terminal resizes.
calc(), min(), max(), clamp(), custom properties with var().
- Tables with
colspan, rowspan and border-collapse.
Motion
transition on colors, sizes, opacity and translate, with every easing curve.
@keyframes animations: delays, steps(), alternate, infinite, animation-play-state.
- Frames that only change colors or positions reuse the last layout, so animations stay cheap.
Interaction
- Mouse: hover, click, drag, wheel, all hit-tested against the real layout.
- Keyboard: Tab order,
tabindex, arrow-key spatial navigation, :focus-visible.
- Select text with the mouse, double-click for a word, triple-click for a line, then copy.
- Clickable
<a href> links, through the terminal's OSC 8 hyperlinks.
Batteries included
<input>, <textarea>, <select>, <checkbox>, <radio>, <slider>, <progress>.
<tabs>, <details>, <dialog>, <toast>, <tooltip>, <table>, tree items.
<markdown>, rendered and styled with CSS.
<for virtual="">: lists of 100,000 rows that only lay out what is on screen.
Plain C++
- Bind members, methods and collections of structs. No code generator, no macros to learn.
<if>/<elif>/<else>, <for>, slots and props for your own components.
- Timers and worker threads post back to the UI thread with
PostTask().
- Optional C++26 reflection binds struct fields for you, on compilers that have it.