cssints/clayA native UI laid out by Clay, with no browser and no JS where it runs (an ESP32's firmware), writes its styles with cssints/clay. The same Vite plugin compiles each site to an object literal shaped as Clay's own structs, and header() prints a module of them as C initializers:
import * as import csscss from "cssints/clay" with { type: "cssints" };
export const const pill: css.ClayStylepill = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(
import csscss.const width: (value: css.Size) => css.ClayStylewidth(200),
import csscss.const height: (value: css.Size) => css.ClayStyleheight(38),
import csscss.const justifyContent: (value: css.Align) => css.ClayStylejustifyContent("center"),
import csscss.const alignItems: (value: css.Align) => css.ClayStylealignItems("center"),
import csscss.const bg: <readonly ["rgb(36 40 52)"]>(parts_0: "rgb(36 40 52)") => css.ClayStyle`background-color`.bg("rgb(36 40 52)"),
import csscss.const borderRadius: (...values: [css.Px] | [css.Px, css.Px] | [css.Px, css.Px, css.Px] | [css.Px, css.Px, css.Px, css.Px]) => css.ClayStyle1 to 4 radii: top-left, top-right, bottom-right, bottom-left, as in CSS.borderRadius(19),
import csscss.const border: <readonly ["#969baa"]>(width: css.Px, color_0: "#969baa") => css.ClayStyleA border of that width and colour on every side.border(1, "#969baa"),
);
export const const label: css.ClayStylelabel = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(import csscss.const color: <readonly ["#ebebf0"]>(parts_0: "#ebebf0") => css.ClayStyleThe colour of the text in the element (Clay's `textColor`).color("#ebebf0"), import csscss.const fontSize: (value: css.Px) => css.ClayStylefontSize(14));
import csscss.const width: (value: css.Size) => css.ClayStylewidth("10rem"); // error: Clay counts pixelsimport csscss.boxShadow("0 0 1px red"); // error: no such member in Clay (a shadow is css.shadow, below)static const Clay_ElementDeclaration pill = { .layout = { .sizing = { .width = { .size = { .minMax = { 200, 200 } }, .type = CLAY__SIZING_TYPE_FIXED }, ... }, .backgroundColor = { .r = 36, .g = 40, .b = 52, .a = 255 }, ... };
static const Clay_TextElementConfig label_text = { .textColor = { .r = 235, .g = 235, .b = 240, .a = 255 }, .fontSize = 14 };CLAY(CLAY_ID("Units"), pill) { CLAY_TEXT(CLAY_STRING("switch to g"), label_text); }width, height (pixels, N%, auto for Clay's FIT, stretch for GROW), padding/p and the sides, gap (childGap), flexDirection (row, column), justifyContent and alignItems (start, center, end: Clay's childAlignment, the axis from flexDirection), backgroundColor/bg, borderRadius, border(width, colour), borderWidth, borderColor, overflow("hidden") (clip), float() (floating, below), image(src, { width, height, fit }) (image, below), backgroundImage("linear-gradient(...)") (a renderer effect, not a Clay field: backgroundImage, below), shadow({ x, y, blur, color }) and backdrop({ blur }) (renderer effects, not Clay fields: shadow and backdrop, below), and for text color, fontSize, letterSpacing, lineHeight, textAlign, whiteSpace (wrapMode); cn merges, a later prop wins. Any other property is not a member."Npx"; padding, gap and border widths are whole numbers (uint16_t in Clay). Another unit is a type error and a build error.color grammar, or are colour tokens of cssints/clay's createTokens, and are written as 0-255 r g b a.header(exports) prints a Clay_ElementDeclaration per export and, for one with text props, a Clay_TextElementConfig named <name>_text. A field it does not set is zero, which is Clay's default.hover, focus, active wrap styles. Clay has no states, so the literal has an overlay per state (":active": { backgroundColor }, the fields the state sets, at their values over the base), and header() prints the whole declaration again, <name>_active (<name>_hover_text for text): the page asks Clay and picks one, nothing is merged in C. States do not nest.createTokens and createGlobalTheme(tokens, name, overrides) of cssints/clay, on tables of their own (a web or terminal token is not a Clay one, and a theme of one is a build error). Resolved at build time: a site has its colours at the tokens' values and, under themes, what each theme changes. header() prints every style of a module with a theme again, the theme's name last (units_light, units_active_light, title_text_light), so a page switches at run time by a suffix. A style sees the themes evaluated before it: declare them first, or in a module it imports.fonts("Roboto", "Mono") is the order of the app's font array; .Mono is a style that sets Clay's fontId to 1, and header() prints the order as an enum, font_Roboto = 0, font_Mono = 1 (the export's name, then the font's).import * as import csscss from "cssints/clay" with { type: "cssints" };
export const const t: Tokens<{
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>
t = import csscss.createTokens<{
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>(tokens: {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
} & ValidGroup<{
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>, name?: (path: readonly string[]) => string | TokenName): Tokens<...>
export createTokens
Tokens from an inline DTCG-shaped `const` object: `$type` is inherited through groups, a leaf is `{ $value }` or, when a
`$type` is in scope, the value itself (`bg: "#ffffff"`), a value is a DTCG value or a CSS string of the type's grammar, an
alias is `"{group.token}"`. The variable is the kebab-case path (`--color-bg`), or what the mapper returns for the path.createTokens({
color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
} & ValidGroup<{
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>
color: { $type: "color"$type: "color", surface: {
readonly $value: "rgb(36 40 52)";
}
surface: { $value: "rgb(36 40 52)"$value: "rgb(36 40 52)" }, pressed: {
readonly $value: "#ffc878";
}
pressed: { $value: "#ffc878"$value: "#ffc878" } },
});
import csscss.const createGlobalTheme: <Tokens<{
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>, {
readonly color: {
readonly surface: "white";
};
}>(tokens: Tokens<{
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>, name: string, overrides: {
readonly color: {
readonly surface: "white";
};
} & CheckOverrides<...>) => void
A theme of cssints/clay's tokens, by a name that is a C identifier: header() prints every style again, the name
appended (`<style>_<name>`, `<style>_hover_<name>`, `<style>_text_<name>`). It applies to the styles evaluated after it.createGlobalTheme(const t: Tokens<{
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>
t, "light", { color: {
readonly surface: "white";
} & CheckOverrides<Tokens<{
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>, {
readonly surface: "white";
}, Tokens<{
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>>
color: { surface: "white"surface: "white" } });
export const const font: {
readonly Roboto: css.ClayStyle;
readonly Mono: css.ClayStyle;
} & {
readonly fonts: readonly ["Roboto", "Mono"];
}
font = import csscss.const fonts: <readonly ["Roboto", "Mono"]>(names_0: "Roboto", names_1: "Mono") => {
readonly Roboto: css.ClayStyle;
readonly Mono: css.ClayStyle;
} & {
readonly fonts: readonly ["Roboto", "Mono"];
}
The app's fonts in the order of its font array: a style per name that sets Clay's `fontId`, and the list, which
header() prints as an enum `<export>_<font>`. Each name is a C identifier.fonts("Roboto", "Mono");
export const const units: css.ClayStyleunits = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(
import csscss.const width: (value: css.Size) => css.ClayStylewidth(200),
import csscss.const bg: <readonly [Token<"color", true, "rgb(36 40 52)">]>(parts_0: Token<"color", true, "rgb(36 40 52)">) => css.ClayStyle`background-color`.bg(const t: Tokens<{
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>
t.color: Tokens<{
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>
color.surface: Token<"color", true, "rgb(36 40 52)">surface),
import csscss.const active: (...styles: css.ClayStyle[]) => css.ClayStylePressed: `<name>_active`.active(import csscss.const bg: <readonly [Token<"color", true, "#ffc878">]>(parts_0: Token<"color", true, "#ffc878">) => css.ClayStyle`background-color`.bg(const t: Tokens<{
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>
t.color: Tokens<{
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
}, undefined, {
readonly color: {
readonly $type: "color";
readonly surface: {
readonly $value: "rgb(36 40 52)";
};
readonly pressed: {
readonly $value: "#ffc878";
};
};
}>
color.pressed: Token<"color", true, "#ffc878">pressed)),
);
export const const label: css.ClayStylelabel = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(const font: {
readonly Roboto: css.ClayStyle;
readonly Mono: css.ClayStyle;
} & {
readonly fonts: readonly ["Roboto", "Mono"];
}
font.type Mono: css.ClayStyleMono, import csscss.const fontSize: (value: css.Px) => css.ClayStylefontSize(14));
import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(const font: {
readonly Roboto: css.ClayStyle;
readonly Mono: css.ClayStyle;
} & {
readonly fonts: readonly ["Roboto", "Mono"];
}
font.Serif); // error: not one of the fonts#define T(name) (light ? name##_light : name)
CLAY(CLAY_ID("Units"), pressed ? T(units_active) : T(units)) { CLAY_TEXT(CLAY_STRING("switch to g"), label_text); }Floating elements: float({ ... }) fills Clay's floating, the foundation of menus, popovers and dialogs. Every option is optional, and what it leaves out is Clay's own default, so header() prints only what is set (float() alone is { .attachTo = CLAY_ATTACH_TO_PARENT }). The name is float as in CSS: it is a valid binding, and no other Clay member shares it.
| Option | Clay field | Default |
|---|---|---|
attach: { element, parent } |
attachPoints: which point of the float sits on which point of its parent, each "left top", "center center", "right bottom", ... (x, then y) |
left top on left top |
parent: "Units" |
parentId and attachTo = ELEMENT_WITH_ID: the string of the parent's CLAY_ID("Units") (ASCII; a CLAY_IDI or local id is not one) |
the element the float is a child of (attachTo = PARENT) |
root: true |
attachTo = ROOT: absolute positioning, a dialog on the screen (not with parent) |
off |
offset: { x, y } |
offset: pixels from where attach puts it; a negative number goes left or up |
0, 0 |
expand: { width, height } |
expand: pixels the float's own box grows by, its children's not; not negative |
0, 0 |
zIndex |
zIndex: a whole number, int16_t; floats draw in ascending order, with their children |
0 |
capture: false |
pointerCaptureMode = PASSTHROUGH: the pointer reaches what lies under the float (true is CAPTURE) |
true |
clip: "parent" |
clipTo = ATTACHED_PARENT: clipped to the box its parent is clipped to ("none" is CLIP_TO_NONE; with root it has nothing to clip to, a build error) |
"none" |
parentId is printed as a number, the hash of the id (Clay__HashString(id, 0) computed at build time), because CLAY_ID() is a call and a static const initializer takes constants. A misspelt id is Clay's own FLOATING_CONTAINER_PARENT_NOT_FOUND error at run time. A bad value, an option that does not exist, a negative expand, a non-ASCII id are build errors (the types catch what a type can: a point such as "top left", an unknown option). Two floats merge in a cn() as the other members do: the later one's options win and the rest stay; a state (hover(float(...))) is a declaration of its own.
import * as import csscss from "cssints/clay" with { type: "cssints" };
export const const menu: css.ClayStylemenu = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(
import csscss.const width: (value: css.Size) => css.ClayStylewidth(160),
import csscss.const bg: <readonly ["#242834"]>(parts_0: "#242834") => css.ClayStyle`background-color`.bg("#242834"),
import csscss.const float: (options?: css.FloatOptions) => css.ClayStyleMakes the element float above the others (Clay's `floating`), and sets `attachTo`: to the element it is a child of, to
the one `parent` names, or to the root. A float is out of the flow of its siblings and of its parent's size.float({ parent?: string | undefinedThe string of the element's `CLAY_ID("...")`, ASCII. Default: the element the float is a child of.parent: "Units", attach?: {
element?: css.AttachPoint;
parent?: css.AttachPoint;
} | undefined
Which point of the floating element sits on which point of its parent. Default: `left top` on `left top`.attach: { parent?: "left bottom" | "left top" | "left center" | "right bottom" | "right top" | "right center" | "center bottom" | "center top" | "center center" | undefinedparent: "left bottom" }, offset?: {
x?: css.Px;
y?: css.Px;
} | undefined
Moves the element from where `attach` puts it, in pixels (a negative one goes left or up). Default: 0, 0.offset: { y?: css.Px | undefinedy: 4 }, zIndex?: number | undefinedDrawn in ascending order, with all the element's children. Default: 0. A whole number of `int16_t`.zIndex: 10 }),
);
export const const dialog: css.ClayStyledialog = import csscss.const float: (options?: css.FloatOptions) => css.ClayStyleMakes the element float above the others (Clay's `floating`), and sets `attachTo`: to the element it is a child of, to
the one `parent` names, or to the root. A float is out of the flow of its siblings and of its parent's size.float({
root?: boolean | undefinedAttach to the layout's root: absolute positioning, or a dialog centred on the screen.root: true,
attach?: {
element?: css.AttachPoint;
parent?: css.AttachPoint;
} | undefined
Which point of the floating element sits on which point of its parent. Default: `left top` on `left top`.attach: { element?: "left bottom" | "left top" | "left center" | "right bottom" | "right top" | "right center" | "center bottom" | "center top" | "center center" | undefinedelement: "center center", parent?: "left bottom" | "left top" | "left center" | "right bottom" | "right top" | "right center" | "center bottom" | "center top" | "center center" | undefinedparent: "center center" },
});
import csscss.const float: (options?: css.FloatOptions) => css.ClayStyleMakes the element float above the others (Clay's `floating`), and sets `attachTo`: to the element it is a child of, to
the one `parent` names, or to the root. A float is out of the flow of its siblings and of its parent's size.float({ attach?: {
element?: css.AttachPoint;
parent?: css.AttachPoint;
} | undefined
Which point of the floating element sits on which point of its parent. Default: `left top` on `left top`.attach: { element: "top left" } }); // error: a point is x, then ystatic const Clay_ElementDeclaration menu = { .layout = { ... }, .backgroundColor = { ... }, .floating = { .offset = { .x = 0, .y = 4 }, .parentId = 3516868942u, .zIndex = 10, .attachPoints = { .element = CLAY_ATTACH_POINT_LEFT_TOP, .parent = CLAY_ATTACH_POINT_LEFT_BOTTOM }, .attachTo = CLAY_ATTACH_TO_ELEMENT_WITH_ID } };Images: image(src, { width, height, fit }) fills Clay's image: the element that draws a picture, its children none. Clay 1.0's Clay_ImageElementConfig is one field, void *imageData, which Clay passes to the renderer untouched, so the path of the image travels in it (the desktop renderer loads it with ThorVG; the firmware's own renderer is still the app's to write). Older Clay also kept the image's sourceDimensions there; 1.0 has no such field, so the image's own size becomes the element's box, and fit is Clay's aspectRatio:
| Option | Clay field | Default |
|---|---|---|
"glyph.png" (argument 1) |
image.imageData: the path, printed as a C string, (void *)"glyph.png" |
— |
width, height |
layout.sizing: the image's size, CLAY_SIZING_FIXED, whole pixels (a later width of a cn() wins) |
— |
fit: "contain" |
aspectRatio: width / height, which Clay uses where it has one side to derive the other's ("fill" stretches) |
"fill" |
A path that is not a non-empty string, a size that is not a positive whole number, an option that does not exist are build errors. fit is how the picture meets a box another style gives it: fill (CSS's object-fit default) stretches it, contain keeps the image's proportions.
import * as import csscss from "cssints/clay" with { type: "cssints" };
export const const glyph: css.ClayStyleglyph = import csscss.const image: (src: string, options: css.ImageOptions) => css.ClayStyleAn image element: the path it is loaded from, and its size in whole pixels, which is the element's box. `fit`
`"contain"` keeps its proportions in a box another style grows (Clay's `aspectRatio`); the path is passed to the
renderer as `imageData`.image("examples/sensors/glyph.png", { width: css.PxThe image's width in whole pixels: the element's box starts at the image's own size.width: 32, height: css.PxThe image's height in whole pixels.height: 32 });
export const const logo: css.ClayStylelogo = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(
import csscss.const image: (src: string, options: css.ImageOptions) => css.ClayStyleAn image element: the path it is loaded from, and its size in whole pixels, which is the element's box. `fit`
`"contain"` keeps its proportions in a box another style grows (Clay's `aspectRatio`); the path is passed to the
renderer as `imageData`.image("assets/logo.png", { width: css.PxThe image's width in whole pixels: the element's box starts at the image's own size.width: 64, height: css.PxThe image's height in whole pixels.height: 32, fit?: "contain" | "fill" | undefined`"fill"` stretches the image into a box another style gives it; `"contain"` sets Clay's `aspectRatio` to the
image's, so a box that grows keeps its proportions. Default: `"fill"`, as CSS's `object-fit`.fit: "contain" }),
import csscss.const width: (value: css.Size) => css.ClayStylewidth("stretch"),
);
import csscss.const image: (src: string, options: css.ImageOptions) => css.ClayStyleAn image element: the path it is loaded from, and its size in whole pixels, which is the element's box. `fit`
`"contain"` keeps its proportions in a box another style grows (Clay's `aspectRatio`); the path is passed to the
renderer as `imageData`.image("logo.png", { width: css.PxThe image's width in whole pixels: the element's box starts at the image's own size.width: 64, height: css.PxThe image's height in whole pixels.height: 32, fit: "cover" }); // error: fill or containstatic const Clay_ElementDeclaration glyph = { .layout = { .sizing = { .width = { .size = { .minMax = { 32, 32 } }, .type = CLAY__SIZING_TYPE_FIXED }, .height = { .size = { .minMax = { 32, 32 } }, .type = CLAY__SIZING_TYPE_FIXED } } }, .image = { .imageData = (void *)"examples/sensors/glyph.png" } };Shadows (2026-10-23): shadow({ x, y, blur, color }) is a renderer effect, not a Clay field — Clay_ElementDeclaration has none in Clay 1.0. The declaration keeps its layout, the literal carries the shadow as a sibling key (as an image's path does), and header() prints nothing for it, so the C targets are unchanged and ignore it until a page's own renderer draws it. The shadow is the element's own box, moved by x/y and filled with color, its edge softened by blur (CSS's box-shadow reading, in pixels: the gaussian's sigma is half of it), drawn before the element's own command so the element covers the middle of it. The desktop renderer (native/solid) is the one that draws it today.
| Option | What the renderer draws | Default |
|---|---|---|
x, y |
the element's box moved that many pixels (a negative one goes left or up) | 0, 2 |
blur |
the width of the soft edge, not negative (sigma is half of it) | 12 |
color |
the shadow's colour, any colour a Clay page can draw | rgb(0 0 0 / 0.4) |
| spread, inset | not drawn: the box is the element's own, and the shadow lies outside it | — |
The literal is whole — shadow: { x, y, blur, color: { r, g, b, a } }, unset fields at their defaults — and a state's overlay merges field by field, so css.hover(css.shadow({ blur: 20 })) keeps the base's x, y and colour. The element needs an id: the renderer keys the shadow by Clay's element id (a table a frame, cleared with it), one draw an element, and an anonymous element's shadow is dropped. A blur is not free: the Dialog page's 280x152 panel (blur 24) costs 0.8 ms a frame on the desktop and takes its 360x480 frame from 1.07 to 1.93 ms (Apple M2, one thread, --bench 300; quality 50 and 30 are 1.47 and 1.31 ms, for 5/255 and 15/255 at the shadow's edge). A colour's alpha is what the shadow is worth: over a dimmed page a black one can darken only a little (3/255 under the panel in the dark theme, 41/255 in the light one).
import * as import csscss from "cssints/clay" with { type: "cssints" };
export const const panel: css.ClayStylepanel = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(
import csscss.const width: (value: css.Size) => css.ClayStylewidth(280),
import csscss.const bg: <readonly ["#242834"]>(parts_0: "#242834") => css.ClayStyle`background-color`.bg("#242834"),
import csscss.const borderRadius: (...values: [css.Px] | [css.Px, css.Px] | [css.Px, css.Px, css.Px] | [css.Px, css.Px, css.Px, css.Px]) => css.ClayStyle1 to 4 radii: top-left, top-right, bottom-right, bottom-left, as in CSS.borderRadius(12),
import csscss.const shadow: (options?: css.ShadowOptions) => css.ClayStyleA shadow of the element: a renderer effect, not a Clay field (Clay 1.0 has none), so `header()` prints nothing for it
and the C targets ignore it until a page draws it themselves. The declaration keeps the layout; the renderer draws the
element's own box, offset by `x`/`y` and blurred by `blur`, in `color`, before the element's command. The element needs
an `id`: the renderer keys the shadow by Clay's element id.shadow({ y?: css.Px | undefinedMoves the shadow down (or up, negative). Default: 2.y: 12, blur?: css.Px | undefinedThe blur radius in pixels: the width of the soft edge, not negative. Default: 12.blur: 24, color?: string | undefinedThe colour of the shadow, as any colour a Clay page can draw. Default: `rgb(0 0 0 / 0.4)`.color: "rgb(0 0 0 / 0.45)" }),
);
import csscss.const shadow: (options?: css.ShadowOptions) => css.ClayStyleA shadow of the element: a renderer effect, not a Clay field (Clay 1.0 has none), so `header()` prints nothing for it
and the C targets ignore it until a page draws it themselves. The declaration keeps the layout; the renderer draws the
element's own box, offset by `x`/`y` and blurred by `blur`, in `color`, before the element's command. The element needs
an `id`: the renderer keys the shadow by Clay's element id.shadow({ spread: 2 }); // error: the box is the element's ownimport csscss.const shadow: (options?: css.ShadowOptions) => css.ClayStyleA shadow of the element: a renderer effect, not a Clay field (Clay 1.0 has none), so `header()` prints nothing for it
and the C targets ignore it until a page draws it themselves. The declaration keeps the layout; the renderer draws the
element's own box, offset by `x`/`y` and blurred by `blur`, in `color`, before the element's command. The element needs
an `id`: the renderer keys the shadow by Clay's element id.shadow({ blur: "1rem" }); // error: a blur is pixels// no shadow here: a renderer effect, not a Clay field
static const Clay_ElementDeclaration panel = { .layout = { .sizing = { .width = { .size = { .minMax = { 280, 280 } }, .type = CLAY__SIZING_TYPE_FIXED } } }, .backgroundColor = { .r = 36, .g = 40, .b = 52, .a = 255 }, .cornerRadius = { .topLeft = 12, .topRight = 12, .bottomRight = 12, .bottomLeft = 12 } };Backdrops (2026-10-23): backdrop({ blur }) is glass over our own content — a menu or a panel over the page we draw, its fill translucent, the pixels under it blurred. The window behind the window is out of reach: nothing outside the frame's buffer can be sampled, so this is what CSS's backdrop-filter shows when the backdrop is the same page, not the desktop. As shadow is, it is a renderer effect, not a Clay field: Clay_ElementDeclaration has none in Clay 1.0, the literal carries a sibling backdrop: { blur } key, header() prints nothing for it, and the C targets are unchanged. The renderer draws everything before the element's first command, blurs the element's box in its own buffer, then draws the element's own commands over the blurred pixels — its text and border stay crisp. The element needs an id, one backdrop an element. blur is a radius in pixels, read as CSS reads one (the gaussian's sigma is half of it).
| Option | What the renderer does | Default |
|---|---|---|
blur |
blurs the element's box under it, not negative | 12 |
| — | no spread, no saturation or tint: only blur, and one an element |
— |
The desktop renderer (native/solid) is the only one that draws a backdrop today; the box is the element's first rectangle command, clipped to the canvas, and nothing is blurred outside it. The blur is three box passes each way on the CPU, on the region alone; on the Dialog page's 150x133 menu (blur 10) the frame's draw goes from 2.2 to 3.0 ms (Apple M2, one thread, back-to-back 300-frame runs), and the radius barely moves it — the frame's split into two draws is the cost. A panel may keep its own shadow: it is drawn before the blur, so it lies on the unblurred page, under the glass. The browser (a dual Kawase pass), the board and the terminal have none.
import * as import csscss from "cssints/clay" with { type: "cssints" };
// a menu: the page shows through its fill, blurred; its own text is drawn after the blur
export const const menu: css.ClayStylemenu = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(
import csscss.const width: (value: css.Size) => css.ClayStylewidth(150),
import csscss.const bg: <readonly ["rgb(23 27 32 / 0.72)"]>(parts_0: "rgb(23 27 32 / 0.72)") => css.ClayStyle`background-color`.bg("rgb(23 27 32 / 0.72)"),
import csscss.const borderRadius: (...values: [css.Px] | [css.Px, css.Px] | [css.Px, css.Px, css.Px] | [css.Px, css.Px, css.Px, css.Px]) => css.ClayStyle1 to 4 radii: top-left, top-right, bottom-right, bottom-left, as in CSS.borderRadius(10),
import csscss.const backdrop: (options?: css.BackdropOptions) => css.ClayStyleA backdrop of the element: the content under it is blurred, then the element is drawn over it, so a translucent fill
is glass over our own page (the desktop behind the window is out of reach). A renderer effect, not a Clay field, as
`shadow` is: `header()` prints nothing for it and only a renderer that reads it draws one. The element needs an `id`.
Today `cssints-native`'s `solid/` ThorVG renderer is the one that blurs.backdrop({ blur?: css.Px | undefinedThe blur radius in pixels, as CSS's `backdrop-filter` reads one: about twice the gaussian's standard deviation.
Not negative. Default: 12.blur: 10 }),
);
import csscss.const backdrop: (options?: css.BackdropOptions) => css.ClayStyleA backdrop of the element: the content under it is blurred, then the element is drawn over it, so a translucent fill
is glass over our own page (the desktop behind the window is out of reach). A renderer effect, not a Clay field, as
`shadow` is: `header()` prints nothing for it and only a renderer that reads it draws one. The element needs an `id`.
Today `cssints-native`'s `solid/` ThorVG renderer is the one that blurs.backdrop({ spread: 2 }); // error: the box is the element's ownimport csscss.const backdrop: (options?: css.BackdropOptions) => css.ClayStyleA backdrop of the element: the content under it is blurred, then the element is drawn over it, so a translucent fill
is glass over our own page (the desktop behind the window is out of reach). A renderer effect, not a Clay field, as
`shadow` is: `header()` prints nothing for it and only a renderer that reads it draws one. The element needs an `id`.
Today `cssints-native`'s `solid/` ThorVG renderer is the one that blurs.backdrop({ blur: "1rem" }); // error: a blur is pixels// no backdrop here either: the declaration keeps its layout and its translucent fill
static const Clay_ElementDeclaration menu = { .layout = { .sizing = { .width = { .size = { .minMax = { 150, 150 } }, .type = CLAY__SIZING_TYPE_FIXED } } }, .backgroundColor = { .r = 23, .g = 27, .b = 32, .a = 184 }, .cornerRadius = { .topLeft = 10, .topRight = 10, .bottomRight = 10, .bottomLeft = 10 } };Gradients (2026-10-23): backgroundImage("linear-gradient(...)") fills the element's box with a linear gradient, written as CSS writes it — one string, the function, an optional direction, the stops. Clay 1.0 has no gradient field, so as shadow and backdrop are, it is a renderer effect: the declaration keeps its layout and its solid fill, the literal carries a sibling backgroundImage: { kind: "linear", angle, stops: [{ offset, color: { r, g, b, a } }] } key, header() prints nothing for it, the C targets draw the solid fill, and the desktop renderer (native/solid) fills the box with the gradient instead of backgroundColor. The element needs an id, and a solid backgroundColor too: Clay emits a rectangle command for a box whose fill is not transparent, and that command is where the gradient goes (the solid is not drawn then).
| Part | What it is | Default |
|---|---|---|
linear-gradient( … ) |
the only function: radial-gradient, conic-gradient, a repeating one, url() and image-set() are build errors |
— |
| the direction | <number>deg (0 up, 90 right, 180 down, 270 left), or to top/to right/to bottom/to left, which are 0, 90, 180, 270 |
180deg, to bottom |
| two or more stops | a colour through bg's parser (tokens too), and an optional <number>% from 0 to 100, in order; fewer than two, or a percentage that goes back, is a build error |
— |
a stop without a % |
spread evenly between the stops that have one, as CSS does: an unpositioned first stop is 0%, an unpositioned last one 100% | — |
The literal's offsets are 0 to 1. A stop's colour is resolved at build time per theme, as a bg token is, so a gradient of tokens lights up in the light theme by itself. A state may set backgroundImage whole, css.hover(css.backgroundImage(...)), which is how the Sky page's cards lighten under the pointer; it cannot unset one — override it or leave it out. Up to 8 stops are drawn; a ninth is dropped and counted as a renderer error, not a crash. Only a fill is drawn: there is no gradient on text, a border or an image, and the browser, the board and the terminal have none (the C targets keep the solid fill).
import * as import csscss from "cssints/clay" with { type: "cssints" };
// a card's fill: the panel token at the top, a step deeper at the bottom; `to right` would be 90deg
export const const card: css.ClayStylecard = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(
import csscss.const width: (value: css.Size) => css.ClayStylewidth("100%"),
import csscss.const bg: <readonly ["rgb(27 32 38)"]>(parts_0: "rgb(27 32 38)") => css.ClayStyle`background-color`.bg("rgb(27 32 38)"),
import csscss.const backgroundImage: (gradient: string) => css.ClayStyleA background image of the element, as CSS's `linear-gradient()` in one string: an optional direction (`<number>deg`, or
`to top | to bottom | to left | to right`) and two or more colour stops with an optional `<number>%` each. Only a linear
gradient is drawn. It is a renderer effect, not a Clay field, as `shadow` is: `header()` prints nothing for it and only
a renderer that reads it draws one; the C targets keep their solid fill. `header()` and the C pages ignore it, the
desktop renderer fills the element's box instead of `backgroundColor`, and the element needs an `id`.backgroundImage("linear-gradient(180deg, rgb(27 32 38), rgb(21 25 30))"),
);
// a state overrides the whole gradient: the card lightens under the pointer
export const const hovered: css.ClayStylehovered = import csscss.const cn: (...styles: css.ClayStyle[]) => css.ClayStyleMerges styles in argument order: a later prop wins.cn(
const card: css.ClayStylecard,
import csscss.const hover: (...styles: css.ClayStyle[]) => css.ClayStyleUnder the pointer: header() prints the style with it as `<name>_hover`. States do not nest.hover(import csscss.const backgroundImage: (gradient: string) => css.ClayStyleA background image of the element, as CSS's `linear-gradient()` in one string: an optional direction (`<number>deg`, or
`to top | to bottom | to left | to right`) and two or more colour stops with an optional `<number>%` each. Only a linear
gradient is drawn. It is a renderer effect, not a Clay field, as `shadow` is: `header()` prints nothing for it and only
a renderer that reads it draws one; the C targets keep their solid fill. `header()` and the C pages ignore it, the
desktop renderer fills the element's box instead of `backgroundColor`, and the element needs an `id`.backgroundImage("linear-gradient(180deg, #2a303a, #1f242b)")),
);
import csscss.const backgroundImage: (gradient: string) => css.ClayStyleA background image of the element, as CSS's `linear-gradient()` in one string: an optional direction (`<number>deg`, or
`to top | to bottom | to left | to right`) and two or more colour stops with an optional `<number>%` each. Only a linear
gradient is drawn. It is a renderer effect, not a Clay field, as `shadow` is: `header()` prints nothing for it and only
a renderer that reads it draws one; the C targets keep their solid fill. `header()` and the C pages ignore it, the
desktop renderer fills the element's box instead of `backgroundColor`, and the element needs an `id`.backgroundImage({ angle: 180 }); // error: one stringimport csscss.backgroundImage(); // error: the gradient is required// no gradient here either: the declaration keeps its layout and its solid fill
static const Clay_ElementDeclaration card = { .layout = { .sizing = { .width = { .size = { .percent = 1 }, .type = CLAY__SIZING_TYPE_PERCENT } } }, .backgroundColor = { .r = 27, .g = 32, .b = 38, .a = 255 } };color-mix() of tokens: a colour Clay is given must parse as one), a theme under a condition (a theme is a name; media() has no meaning on a board).