A number that lives in CSS
Each click runs one declaration. The text on screen is the state.
Add state, events and DOM binding to the stylesheet you already write. One small runtime reads your CSS and wires it up.
Events are selectors. State, attributes and text are custom properties. Here is one disclosure menu, translated line by line.
JavaScript is still the right tool for data, routing and application logic. Reactive CSS covers the interactions in between.
Three demos, each a handful of lines. The Examples catalog has the rest.
All examples →Each click runs one declaration. The text on screen is the state.
Pick a theme, then reload the page. persist() stores the value and restores it before the first paint.
Every rule follows the same path. An event updates a state, the state reaches the DOM, and ordinary CSS styles the result.
Three builds of one runtime. Full and Compact have every module; Compact keeps a shorter feature registry. Custom is yours to choose.
If :has() or :checked already does the job, use it. The runtime only handles what the browser doesn't understand, and without it the page falls back to plain CSS.
Read Simplify CSS →Curated demos from our lab, where Reactive CSS drives light, depth and motion instead of menus and counters. Each one is a stylesheet and the runtime.
A foil collector card: 3D tilt, trailing specular light, parallax layers and a spring return.
Coding agents that speak the Model Context Protocol can use the official @reactivecss/mcp server: current 0.9.0 docs, API lookup, validation and migration help, so generated CSS uses the syntax that actually runs.
<script src="reactive-css.min.js" defer></script> <link rel="stylesheet" href="styles.css">