← All Workshops
MudEngine Part 5: Polished UI with dioxus-components
Step 4 / 11
Link the theme CSS
The components rely on CSS custom properties (colours, spacing, border radii) defined in a theme stylesheet. Without it, they render without styling.
Open src/main.rs and add a document::Stylesheet at the top of the App component's rsx! block, before any other elements:
mud-engine/src/main.rs
document::Stylesheet { href: asset!("/assets/dx-components-theme.css") }
🎯 Where to place it
Insert this line at the very top of the root rsx! block, before the outer div { id: "main" }. It injects a <link rel="stylesheet"> into the document <head>.
Step 4 / 11