Files
dioxus/packages/document/src/elements/stylesheet.rs
T
Jonathan Kelley f2b1c6d97f codify "platform" into resolution logic, server-fn/fullstack overhaul (#4596)
overhaul dioxus fullstack using a new implementation of server_fn

This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
2025-10-03 18:26:19 -07:00

32 lines
830 B
Rust

use super::*;
/// Render a [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link) tag into the head of the page with the stylesheet rel.
/// This is equivalent to the [`Link`](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
})
}