/rtxui:rtxuifrom rtxui
Builds and checks terminal user interfaces with RTXUI, a C++ library using HTML-like templates and CSS-like styles. Use when code includes <rtxui/rtxui.hpp> or when writing/fixing RTXUI components.
Ships in rtxui. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
RTXUI templates look like HTML and Vue, and its styles like browser CSS, but it implements its own subset. Write only the constructs below, then check the result headlessly before saying it works.
#include <rtxui/rtxui.hpp>
using namespace rtxui;
class Counter : public Component<Counter> {
public:
int count = 0;
std::vector<std::string> items = {"a", "b"};
int Doubled() const { return count * 2; } // Computed: bind a const method.
void Increment() { count++; } // Handler: bind a method.
void Remove(int index) { items.erase(items.begin() + index); }
Counter() {
Bind(count);
Bind(items);
Bind(Doubled);
Bind(Increment);
Bind(Remove);
}
std::string_view view = R"html(
<div class="card">
<span>{count} doubled is {Doubled}</span>
<button onclick="Increment">+1</button>
<for each="{items}" as="item">
<div onclick="Remove({$index})">{item}</div>
</for>
</div>
<style>
.card {
border: rounded;
padding: 1;
}
</style>
)html";
};
int main() {
auto app = Ref<Counter>::New();
Screen screen(app);
screen.Loop();
}
Link the CMake target rtxui and include only <rtxui/rtxui.hpp>.
{name} interpolates a bound member or const method. There are no
expressions: no {a + b}, {x == 1}, {ok ? "y" : "n"}. Compute the value
in a const method and bind it.Bind(...). Bind takes a
member name only; Bind("Name", lambda) does not exist.if="{flag}" on any element, or <if condition="{flag}"> with
<elif condition="..."> and <else>. True means the value prints as true
or 1. Never v-if, :if or *ngIf.<for each="{list}" as="item"> with {item} and {$index}. Never
v-for or for="x in xs". When items move or disappear, give the loop a
key, <for each="{tasks}" as="task" key="{task.id}">, so each item keeps
its own element: its focus, its running animation.Fields() function gives, declared
next to the struct and before the component:
void Fields(const Task& t, rtxui::FieldSink& out) { out("id", t.id); },
then Bind(tasks) and {task.id}.onclick="Method", or onclick="Method({$index}, 2)" with
arguments converted to the method's parameter types (integers, floats,
bool, std::string, enums by enumerator name with C++26 reflection);
oncontextmenu for the right click.onkey:j="Down", onkey:ArrowDown="Down",
onkey:ctrl+d="Jump(10)", onkey:Escape="Close" on any element; they run
when the focus is on it or inside it, or, with nothing focused, on the
top-level element. onkey="Typed" runs for every key (a handler may take
rtxui::Event::Keyboard; returning false passes the key on). Prefer these
to an OnEvent() override. No @click, braces, statements or
camelCase (onClick). Use class, not className.title="{name}", never :title="name".<slot name="header">fallback</slot> (and an
unnamed <slot>); its user writes <h1 slot="header"> or
<template slot="header">several nodes</template>.<input value="{text}"/>, <textarea value="{text}"/>,
<checkbox checked="{done}">Label</checkbox>,
<radio name="group" checked="{picked}">Label</radio>,
<select value="{choice}">. Checkboxes and radios are their own tags, not
<input type="...">.Import<Header>();, then <Header/>.view member or a std::string_view Setup()
method (no override), never both.<style> at the top level of the view, next to the root element; a
nested <style> is ignored.@keyframes included:
a rule only matches elements its own template wrote, and .dark .title in a
child never sees a .dark set by its parent. Pass context down as a custom
property (--accent, which inherits) or as a prop.div, span, p, h1-h6, button, a,
input, textarea, checkbox, radio, select, ul/ol/li, table,
dialog, tabs, toast, tree-item, ...) and imported components. There
is no <View>, <Text> or <Box>. A notification is
<toast open="{saved}" duration="3000">Saved</toast>: it slides in, and
saved falls back to false once it closes.width: 20), %, or vh/vw (shares
of the terminal); there is no px, em or rem. font-size and font-family
do not exist; use font-weight, font-style, text-decoration, colors and
border (solid, rounded, double, tall, ...).transition: width 200ms ease-out 100ms (property, duration, then
optional timing function and delay), or @keyframes slide { from { ... } }
with animation: slide 300ms ease-in forwards. Colors, opacity, width,
height, top/right/bottom/left, translate and flex-grow animate.
translate: 0 -1 moves a box without moving anything around it, and its
percentages are of the box's own size: translate: calc(100% + 2) puts it
just out of sight. There is no transform. onanimationend="Method" runs
once an animation finishes, for instance to remove an item that slid out.apt install does, as tall as
its content. For one that takes the whole terminal, as an editor does, call
screen.SetInline(false); before screen.Loop(). screen.Print("text") or
screen.Print(rtxui::Ref<Line>::New(...)) writes lines above it that stay
in the terminal's history; the last frame drawn stays once Loop() returns.rtxui::PostTask([...] { ... });, which is safe to
call from any thread.When unsure whether a property, tag or attribute exists, check the references
rather than guessing: https://arthursonzogni.github.io/RTXUI/llms-full.txt
(the whole manual as Markdown), or docs/css_reference.md and
docs/html_reference.md in the RTXUI repository.
Never claim an interface works from reading the code. Build it, then run it
headless. RTXUI_STRICT=1 aborts on anything RTXUI would silently ignore (an
unknown CSS property, an unbound name, another framework's syntax) and prints
why; RTXUI_HEADLESS=<width>x<height> prints the screen as text instead of
taking over the terminal:
RTXUI_STRICT=1 RTXUI_HEADLESS=80x24 ./my_app < /dev/null
Drive it by piping terminal input. The screen printed is the one after all of it is handled:
printf '\t\t\r' | RTXUI_STRICT=1 RTXUI_HEADLESS=80x24 ./my_app
| Input | Bytes |
|---|---|
| Typed text | the text |
| Tab, Shift+Tab, Enter, Backspace | \t, \x1b[Z, \r, \x7f |
| Up, Down, Right, Left | \x1b[A, \x1b[B, \x1b[C, \x1b[D |
| Click column x, row y (1-based) | \x1b[<0;x;yM\x1b[<0;x;ym |
Read the printed screen and compare it with what was asked. In C++ tests,
rtxui::HeadlessScreen screen(app, 80, 24); offers Input(bytes),
Click(x, y) (0-based), Resize(w, h) and Text(), plus
WaitUntil([&] { return condition; }) for work a thread hands back with
PostTask().
Headless runs wait for animations to end. To check what happens over time (an
animation, a transition, a PostDelayedTask timer), use
rtxui::TimelineScreen screen(app, 80, 24);: time moves only when told,
Advance(ms) returns the frame drawn at that moment, Record(ms) every
distinct frame, and BackgroundAt(x, y) a cell's color, which text cannot
show.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub arthursonzogni/rtxui --plugin rtxuiOther plugins' skills for the same job