Documentation

DOC / 06 / AUTHOR

Rust views

Compose semantic views with escaped text, typed macros, stable attributes, and useful HTML first.

In this guideRust views
Getting startedProject structureCLI referenceDeveloper loopRouting and pagesRust viewsEvents and foldsSchemas and snapshotsHyphae verified syncTyped contentBrowser runtimeDOM ownershipAdaptive assetsArtifact trustErrors and diagnosticsBuild and deployCrates and APILicensing and policy

Compose semantic HTML

rust
use pliego_dom::{IntoView, View, el};

fn notice(title: &str, body: &str) -> View {
    el("aside")
        .attr("aria-labelledby", "notice-title")
        .child(el("h2").id("notice-title").child(title.to_owned()))
        .child(el("p").child(body.to_owned()))
        .into_view()
}

Text nodes and attribute values are escaped by the renderer. Structural names are validated at construction boundaries; raw HTML is never the default path.

Typed view macro

rust
use pliego_macros::view;

let page = view! {
    <main class="shell">
        <h1>{title}</h1>
        <p>{summary}</p>
    </main>
};

Use the builder for dynamic composition and view! for concise authored trees. Both produce the same View contract and deterministic HTML.

Useful HTML first

Navigation, content, forms, headings, landmarks, and essential controls belong in the authored document. Rust/WASM resumes owned behavior at explicit boundaries instead of reconstructing the page.

Mounted ownership

A mounted scope owns its reactive children, DOM listeners, adapter instances, cancellation handles, and cleanup. Unmounting the scope disposes the complete subtree.