dioxus_document/elements/
stylesheet.rs

1use super::*;
2
3/// Render a [`link`](crate::elements::link) tag into the head of the page with the stylesheet rel.
4/// This is equivalent to the [`Link`](crate::Link) component with a slightly more ergonomic API.
5///
6///
7/// # Example
8/// ```rust
9/// # use dioxus::prelude::*;
10/// fn RedBackground() -> Element {
11///     rsx! {
12///         document::Stylesheet {
13///             href: asset!("/assets/style.css")
14///         }
15///     }
16/// }
17/// ```
18///
19/// <div class="warning">
20///
21/// Any updates to the props after the first render will not be reflected in the head.
22///
23/// </div>
24#[component]
25pub fn Stylesheet(props: LinkProps) -> Element {
26    super::Link(LinkProps {
27        rel: Some("stylesheet".into()),
28        r#type: Some("text/css".into()),
29        ..props
30    })
31}