Skip to content

Styling basics

Style headless components with CSS-like rules or Rust values.

On this page

Inrux components provide behavior and minimal overridable defaults. Your application owns the visual design. The playground theme is an example, not a required design system.

Choose CSS-like or Rust styling

xml
<Button text="Save" class="primary" @click={save} />
css
.primary {
    padding: 12px;
    background: #b84200;
    color: white;
    border-radius: 6px;
}
.primary:hover {
    background: #913400;
}

The equivalent Rust style can use Style::new().padding(12.0).background(Color(184, 66, 0)). Both approaches feed typed Inrux styles. They do not pass a browser stylesheet to the native engine.

Global and scoped sheets

Load application-global CSS from the entry point. Use <style scoped> for styles attached to a component's authored nodes. A component may also supply a global <style> block. Explicit Rust/template styles override matching sheet values.

Scoped rules do not provide a browser DOM or general descendant matching. Use public parts to target supported inner surfaces such as a Switch thumb or editor placeholder.

Compilation and runtime work

The .iru compiler turns style blocks into Rust rule values. You can precompile standalone CSS in build.rs with compile_stylesheet; the playground does this for light and dark themes. The scaffold currently parses its global CSS once at startup.

Inrux indexes selectors by their anchor and evaluates typed matching at runtime. Compiling CSS removes repeated parsing; it does not remove all selector, layout or paint costs.

Learn the exact subset

Start with classes/IDs, literal colors, dimensions, uniform padding, gaps and flex/grid layout. Read CSS reference before assuming a browser property works. Unsupported syntax returns an error rather than silently doing nothing.

Current limits include no calc, combinators, general attribute selectors, !important, shadows, gradients, transforms or transitions. Typography and grid support are smaller than browser CSS. See themes and responsiveness for supported tokens and viewport rules.

Inrux · Built with Nuxt Content, IPEX, and Akaza UI.