Expand description
dioxus_style/src/lib.rs Scoped CSS styling for Dioxus
Macros§
Structs§
- Scoped
Style - Helper struct for managing a single scoped style instance. Uses &’static str for zero-allocation access to compile-time embedded strings.
- Style
Registry - 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
csswith class constants