Expand description
§wabot-addon-ui-maud
The default renderer for wabot’s UI controllers. Maud compiles
html! { … } into string-pushing code at build time and escapes
interpolated values by construction, so a view is a normal Rust
function that happens to return HTML.
Chosen over Leptos/Dioxus because it adds no client payload and no
build step — see docs/ui-renderer-review.md for the full
comparison.
ⓘ
use maud::html;
use wabot_addon_ui_maud::{island, IntoView};
#[view("/")]
async fn index(&self) -> UiResult<ViewBody> {
Ok(html! {
h1 { "Dashboard" }
(island("counter", &CounterProps { start: 3 }, html! {
button { "3" } // server-rendered, works without JS
}))
}
.into_view())
}The island’s markup is what the server sends and what a visitor
sees before (or without) JavaScript. wabot.island('counter', …)
in the app’s own script takes it from there.
Re-exports§
pub use ::maud;
Traits§
Functions§
- island
- Emit an interactive island.
- island_
bare - Emit an island with no props.
- island_
module - Emit an island and declare the module that mounts it, so the page loads only the island bundles it actually used.
- link
- Set the document title from inside the markup.
Declare a
<link>that is not a stylesheet — a favicon, a preload. - meta
- Set a
<meta name=… content=…>pair. - outlet
- Placeholder a layout renders where the current view goes.
- script
- Declare an extra module script this view needs — typically the JS that registers its islands.
- style
- Declare a stylesheet this view needs. Re-exported so a view file only imports from this crate.
- title