Skip to main content

Spacers and dividers

Spacers take up free space so siblings are pushed apart, and dividers draw thin rule lines. They need no id, so they are safe inside loops.

Leaves with no id and no block. Safe to use in loops.

Example​

static void toolbar(void) {
Row("Toolbar", .layout = { .sizing = { Grow(), Fixed(40) },
.childAlignment = { .y = AlignYCenter() } }) {
Text("File");
Text("Edit");
HSpacer(); // pushes Settings to the right
Text("Settings");
}
HDivider(.thickness = 1, .color = ColorHex(0x333333));
Spacer(.height = Fixed(12)); // fixed 12px gap
}

Reference​

NameFormWhat it doesPage
HSpacerHSpacer()Grows along the width. Pushes siblings apart in a Row.Spacer and divider
VSpacerVSpacer()Grows along the height. Pushes siblings apart in a Column.Spacer and divider
SpacerSpacer(.width = ..., .height = ...)Spacer with explicit sizing per axis. Unset axes are Fit(). Fields: CC_SpacerOpts.Spacer and divider
HDividerHDivider(.length, .thickness, .color)Horizontal rule. length 0 grows, thickness defaults to 1, color to the global font color. Fields: CC_DividerOpts.Spacer and divider
VDividerVDivider(.length, .thickness, .color)Vertical rule. Same fields as HDivider.Spacer and divider
CC_HSpacer, CC_VSpacer, CC_Spacer, CC_HDivider, CC_VDividerfunctionsWhat the macros above call.