Skip to main content

dioxus_bootstrap_css/
head.rs

1use dioxus::prelude::*;
2
3const BOOTSTRAP_CSS: Asset = asset!("/assets/bootstrap.min.css");
4const BOOTSTRAP_ICONS_CSS: Asset = asset!("/assets/bootstrap-icons.min.css");
5
6/// Loads Bootstrap 5.3.3 CSS and Bootstrap Icons as bundled static assets.
7///
8/// Place this at the top of your app, before any Bootstrap components.
9///
10/// ```rust
11/// rsx! {
12///     BootstrapHead {}
13///     // your app content
14/// }
15/// ```
16#[component]
17pub fn BootstrapHead() -> Element {
18    rsx! {
19        document::Link { rel: "stylesheet", href: BOOTSTRAP_CSS }
20        document::Link { rel: "stylesheet", href: BOOTSTRAP_ICONS_CSS }
21    }
22}