feat(dsl): add a library of structural screen layouts
#2 in tonybierman/dioxus-mcp — merged 2026-05-28
What
Adds 12 page-level structural screen layouts to the registry, selectable via a screen's template.kind exactly like the existing kinds:
| Structural | Navigation | Content |
|---|---|---|
holy_grail, bento_grid, masonry, full_bleed |
sticky_sidebar, mega_menu, drawer |
card_grid, editorial, hero_scroll, split_screen, scroll_sticky |
*interactive — templates wire a use_signal open/close toggle.
How
Each layout is a complex: false LayoutDescriptor:
- a Tailwind-classed minijinja
templatethat emits a full component file (honorswrap_withvia conditional wrapper braces;{{ root_class }}rides along as a customization hook soclass:overrides still apply) - a
previewskeleton for the cockpit navigator's approximate render
They're seeded as built-ins (registry::builtin_layouts) so they ship with every project and surface in get_registry. No DSL parser or render-pipeline changes — the registry's runtime-layout path (render_registry_layout) already supported this shape.
The CORE_SCREEN DSL spec now documents the structural kinds, notes the Tailwind assumption, and points at get_registry as the authoritative list.
Styling / scope decisions
- Tailwind utility classes (matches the existing
styled: tailwindpreset onclient_crud) — no CSS files, no schema change. Generated Rust compiles regardless of whether Tailwind is wired up; it just won't look styled without it. - Deliberately skips the CSS-technique trio (subgrid / container-query / intrinsic) — those are styling techniques more than distinct page shells.
Files
crates/dioxus-mcp/src/tools/dsl/layout_library.rs(new) — 12 templates,library_layouts(), testscrates/dioxus-mcp/src/tools/dsl/mod.rs—pub(crate) mod layout_library;crates/dioxus-mcp/src/registry.rs— chain library intobuiltin_layouts()(5 → 17); count tests updatedcrates/dioxus-mcp/src/tools/dsl/specs.rs—CORE_SCREENdoc +holy_grailexample
Verification
- Full suite green (458 + 39 tests);
cargo fmt+cargo clippy --all-targets -D warningsclean. - Real compile check: rendered all 12 bodies and compiled them against actual Dioxus 0.7 — the conditional
class: if … {},if/fornodes, event closures, anduse_signaltoggles all build clean (the one thing string-level tests can't prove). - Confirmed live
get_registryreturns all 12 once the server runs the rebuilt binary.
🤖 Generated with Claude Code
Last updated 2026-05-28
Links to this note
Merged pull requests, newest first.