Inspired by react-helmet, this small Dioxus component allows you to place elements in the head of your code.
Add the package as a dependency to your Cargo.toml
.
rust
dioxus-helmet = "0.1.1"
rust
dioxus-helmet = { version = "0.1.1", default-features = false, features = ["desktop"] }
Import it in your code:
rust
use dioxus_helmet::Helmet;
Then just use it anywhere in your components like this:
rust
cx.render(rsx! {
div {
Helmet {
link { rel: "stylesheet", href: "/style.css" }
title { "Helmet" }
style {
[r#"
body {
color: blue;
}
a {
color: red;
}
"#]
}
},
p { "Hello, world!" }
}
})
Any children passed to the helmet component will be placed in the <head></head>
of your document.
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in dioxus-helmet by you, shall be licensed as MIT, without any additional terms or conditions.