-
I would like to print out the html that would be generated by my rsx! element. So far I've found this render_template_to_html function, but it only seems to work with static html, not dynamic components: // Custom button component wrapper around DaisyUI's button classes
//
// The resulting html would be something like
// `<button class="btn btn-primary" data-dioxus-id="105">Primary</button>`
let preview = rsx! {
Button { color: ButtonColor::Primary, "Primary" }
};
// This just results in
// `<!--placeholder-->`
let html = dioxus_elements::render_template_to_html(&preview.as_ref().unwrap().template); I'm suspecting I need to actually render the item to an element or something. Any ideas? |
Beta Was this translation helpful? Give feedback.
Answered by
ealmloff
Jan 27, 2025
Replies: 1 comment 1 reply
-
You can use the dioxus-ssr crate to render components to a html string. The examples in the crate have more information: https://docs.rs/dioxus-ssr/latest/dioxus_ssr/ |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Plebshot
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use the dioxus-ssr crate to render components to a html string. The examples in the crate have more information: https://docs.rs/dioxus-ssr/latest/dioxus_ssr/