Being revived in 2026, on C++23

Native UI in C++, styled like the web.

Psychic UI is a retained-mode UI library. Skia draws, Yoga lays out with flexbox, and a CSS-like style system with skin sets and themes drives both.

Skin set
Theme
A lighting design tool made of Psychic UI components: floating panels over a dotted canvas, a layer tree, an inspector with steppers, a slider, swatches and a switch, and a tool bar with a tooltip

Library components only, rendered by the library offscreen: Default skin set, Pivotal Dark theme.

How it works

A tree of divs, each styled by rules and laid out by flexbox, painted by Skia. Nothing redraws until something changes.

Skia draws, Yoga lays out

Every element is a Div with a Yoga node. Styles and layout update only where they changed, and the loop sleeps until input, a timer or an animation needs a frame.

Styles that cascade

Rules on tags and classes apply by specificity, then by order, as in CSS. :hover, :focus-visible and :touch match; properties inherit; transitions are declared per property.

Skin sets and themes

Components own their behaviour; skins only draw. A skin set supplies the skins and rules, a theme supplies the values: palette, elevation, type, metrics and motion. Light and dark follow the system.

A chainable C++23 API

Every style property has a setter on Div, and every setter returns the most derived type through explicit object parameters, so calls chain in any order.

Motion

Bézier curves and springs solved in closed form, style transitions, entering and leaving classes like CSS's @starting-style, and layout transitions that slide rows to their new places. Reduced motion makes it all instant.

Touch, pen and keyboard

Taps, pans with fling and long presses for context menus; hit slop around small controls; Tab through focusable controls with a focus ring for the keyboard only.

Build a window in a few lines

add<T>() creates a child and returns it, so a tree reads top to bottom. Base and component setters chain in any order, and misuse, like a string where a number belongs, doesn't compile.

SDL3Application runs windows on their own. An application that already has a window and a loop embeds Psychic UI through an SDL3 or GLFW adapter instead: the adapter translates the window's events and chains to the host's callbacks, and the host keeps the window and the loop.

Looks belong in stylesheets, written from the theme, so they follow it when it changes.

class CueWindow : public Window {
public:
    CueWindow() : Window("Cues") {
        skinSet<PivotalSkins>(); // Light or dark with the system

        auto &panel = appContainer().add<Div>().padding(24).gap(12);
        panel.add<Label>("Opening night").addClassName("h2");
        panel.add<Switch>("Blackout").checked(true);
        panel.add<Button>("Go")
             .icon("play")
             .skin("primary")
             .onClick([] { /* run the cue */ });
    }
};

int main() {
    SDL3Application app;
    app.open(std::make_shared<CueWindow>());
    app.run();
}
void CueStyles::load(StyleManager *manager) {
    const Theme &theme = manager->theme();
    manager->style("Button ButtonSkinBase.primary")
           .borderRadius(theme.metrics.radius.control)
           .transition(Property::backgroundColor, theme.metrics.motion.quick());
}

One app, three skin sets

The same demo app, its components untouched. Pick a set to restyle every screenshot on this page.

The demo app from the repository: Default skin set, Pivotal Dark theme.

Pointer and touch

Desk switches density with the input. The same panel, with a mouse and then by touch, where controls grow and each one's touch target reaches 44 px.

Pointer

Touch

Motion

Popups scale and fade from their anchor, and rows slide to their new places when a grid sorts. Captured frame by frame on the library's own clock; the Default set.

A menu opening from its button, its submenu following, then closing

A menu enters, opens its submenu, and leaves.

Data grid rows sliding to new places as the grid sorts

Layout transitions as the grid sorts by one column, then another.

Build it

CMake 3.24 or newer and a C++23 compiler: GCC 14+, Clang 18+, Apple Clang 16+, or clang-cl on Windows. Skia, Yoga and psychic-color are submodules; Skia is built by CMake on the first build, which takes a while.

Inside your own CMake project, add_subdirectory the checkout and link psychic-ui::psychic-ui.

git submodule update --init --recursive
cmake --preset debug
cmake --build --preset debug -j"$(nproc)"

# The demo, the tests, and these screenshots
./build/debug/example/psychic-ui-demo
ctest --preset debug
tools/showcase/capture.sh