Skip to main content

C11 / Clay / raylib

Declarative UI,
written in C.

Compose layouts with familiar C blocks. Let Clay handle the layout and raylib draw the result.

A window, a column, your first interface.

main.c
#include "ccompose.h"

int main(void) {
CC_SetWindow(960, 640, "My first ccompose app");
CC_SetBackground(Color(18, 18, 20, 255));
CC_Init();

while (CC_Running()) {
CC_Begin();

Column("Root",
.layout = { .sizing = { Grow(), Grow() },
.padding = PadAll(24),
.childGap = 12 }) {

Text("Hello, ccompose!",
.textColor = Color(236, 236, 236, 255),
.fontSize = 32);

Row("Toolbar",
.layout = { .childGap = 8,
.childAlignment = { .y = AlignYCenter() } }) {
Text("File", .textColor = Color(200,200,200,255), .fontSize = 14);
Text("Edit", .textColor = Color(200,200,200,255), .fontSize = 14);
Text("View", .textColor = Color(200,200,200,255), .fontSize = 14);
}
}

CC_End();
}

CC_Shutdown();
return 0;
}

From the first window to the full layout.

Learn the layout primitives, add interaction, or build for the browser.

Browse ccompose on GitHub.