pub struct NavbarProps {
pub color: Option<Color>,
pub expand: NavbarExpand,
pub brand: Option<Element>,
pub container: NavbarContainer,
pub class: String,
pub children: Element,
/* private fields */
}Expand description
Bootstrap Navbar component.
§Bootstrap HTML → Dioxus
<!-- Bootstrap HTML -->
<nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">MyApp</a>
<button class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#nav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="nav">
<ul class="navbar-nav"><li class="nav-item"><a class="nav-link" href="/">Home</a></li></ul>
</div>
</div>
</nav>// Dioxus equivalent
let collapsed = use_signal(|| true);
rsx! {
Navbar { expand: NavbarExpand::Lg, class: "bg-body sticky-top",
brand: rsx! { a { class: "navbar-brand", href: "#", "MyApp" } },
NavbarToggler { collapsed: collapsed }
NavbarCollapse { collapsed: collapsed,
NavbarNav {
NavItem { NavLink { href: "/", active: true, "Home" } }
NavItem { NavLink { href: "/about", "About" } }
}
}
}
}Fields§
§color: Option<Color>Navbar color scheme.
expand: NavbarExpandResponsive expand breakpoint.
brand: Option<Element>Brand element (logo, app name).
container: NavbarContainerThe container wrapping brand and children. Defaults to
NavbarContainer::Fluid (container-fluid), which is Bootstrap’s own
default and what this component emitted before the prop existed. Set
NavbarContainer::None when the navbar pads itself and must not gain
the container’s gutter on top.
class: StringAdditional CSS classes.
children: ElementChild elements (nav items, collapse, etc.).
Implementations§
Sourcepub fn builder() -> NavbarPropsBuilder<((), (), (), (), (), (), ())>
pub fn builder() -> NavbarPropsBuilder<((), (), (), (), (), (), ())>
Create a builder for building NavbarProps.
On the builder, call .color(...)(optional), .expand(...)(optional), .brand(...)(optional), .container(...)(optional), .class(...)(optional), .attributes(...)(optional), .children(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of NavbarProps.
Trait Implementations§
Source§fn clone(&self) -> NavbarProps
fn clone(&self) -> NavbarProps
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more