Skip to main content

Crate dioxus_style

Crate dioxus_style 

Source
Expand description

dioxus_style/src/lib.rs Scoped CSS styling for Dioxus

Macros§

component_with_css
scoped_style

Structs§

ScopedStyle
Helper struct for managing a single scoped style instance. Uses &’static str for zero-allocation access to compile-time embedded strings.
StyleRegistry
Registry that tracks all scoped styles in the application. Uses &’static str to avoid runtime allocations - all CSS is embedded at compile time.

Enums§

CssClass
A CSS class or collection of classes.

Statics§

STYLE_REGISTRY
Global registry for all scoped styles. Uses OnceLock (Rust 1.70+) instead of lazy_static for better performance. RwLock allows concurrent reads which is the common case for inject_styles().

Functions§

inject_styles
Gets all styles from the global registry as a single CSS string for injection. Uses cached output for 10-50x faster repeated calls.

Attribute Macros§

with_css
New attribute macro with namespace support Usage: #[with_css(css, “assets/counter.scss”)] This generates a module called css with class constants