Houdini is a collection of low-level APIs that give developers direct access to the CSS engine —
letting you paint custom backgrounds, create typed custom properties, and define layout algorithms
that the browser natively executes.
🎨
Paint API
Register a PaintWorklet class and use it as a CSS background-image
value via paint(yourWorkletName). The worklet receives a canvas-like context,
the element's dimensions, and any registered custom properties — and paints on every repaint.
/* 1. Register the worklet */await CSS.paintWorklet.addModule('pattern-worklet.js');
/* 2. Use it in CSS */.my-element {
background-image: paint(patternPainter);
--pattern-density: 12;
--pattern-size: 40;
}
🔑
@property — Typed Custom Properties
@property lets you declare the type, initial value, and inheritance
of custom properties. This unlocks CSS transitions on things like colors and numbers that
were previously un-interpolatable.
Every paint worklet is a class with an inputProperties static getter
and a paint() method. The browser calls paint() whenever
it needs to render that element's background — efficiently, off the main thread.