dioxus_document/elements/
stylesheet.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use super::*;

/// Render a [`link`](crate::elements::link) tag into the head of the page with the stylesheet rel.
/// This is equivalent to the [`Link`](crate::Link) component with a slightly more ergonomic API.
///
///
/// # Example
/// ```rust
/// # use dioxus::prelude::*;
/// fn RedBackground() -> Element {
///     rsx! {
///         document::Stylesheet {
///             href: asset!("/assets/style.css")
///         }
///     }
/// }
/// ```
///
/// <div class="warning">
///
/// Any updates to the props after the first render will not be reflected in the head.
///
/// </div>
#[component]
pub fn Stylesheet(props: LinkProps) -> Element {
    super::Link(LinkProps {
        rel: Some("stylesheet".into()),
        r#type: Some("text/css".into()),
        ..props
    })
}