pub struct NavProps {
pub pills: bool,
pub tabs: bool,
pub underline: bool,
pub fill: bool,
pub justified: bool,
pub vertical: bool,
pub tag: String,
pub class: String,
pub children: Element,
/* private fields */
}Expand description
Bootstrap Nav component — standalone navigation (not inside a Navbar).
§Bootstrap HTML → Dioxus
<!-- Bootstrap HTML -->
<ul class="nav nav-pills nav-fill">
<li class="nav-item"><a class="nav-link active" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Profile</a></li>
<li class="nav-item"><a class="nav-link disabled">Disabled</a></li>
</ul>rsx! {
Nav { pills: true, fill: true,
NavItem { NavLink { active: true, "Home" } }
NavItem { NavLink { "Profile" } }
NavItem { NavLink { disabled: true, "Disabled" } }
}
// Tabs style
Nav { tabs: true, /* ... */ }
// Underline style
Nav { underline: true, /* ... */ }
// Vertical with pills
Nav { pills: true, vertical: true, /* ... */ }
}§Props
pills— pill styletabs— tab styleunderline— underline stylefill— fill available widthjustified— equal-width itemsvertical— vertical layout
Fields§
§pills: boolUse pill style.
tabs: boolUse tab style.
underline: boolUse underline style.
fill: boolFill available width equally.
justified: boolJustify items to fill width (equal-width items).
vertical: boolVertical layout.
tag: StringNav element. Empty (the default) renders <ul>, whose children are
NavItems wrapping NavLinks; "nav" renders <nav class="nav"> and
takes NavLink/NavButton children directly, with no NavItem layer.
Bootstrap documents both forms, and the choice is not cosmetic: .nav is
a flex container, so the two put different elements in flow. A vertical
nav whose items carry their own spacing or an active-state border lays out
differently once an <li> sits between the container and the link.
Convert an existing <nav class="nav"> to this, not to the <ul> default.
class: StringAdditional CSS classes.
children: ElementChild elements (NavItems, or NavLinks directly when tag is "nav").
Implementations§
Sourcepub fn builder() -> NavPropsBuilder<((), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> NavPropsBuilder<((), (), (), (), (), (), (), (), (), ())>
Create a builder for building NavProps.
On the builder, call .pills(...)(optional), .tabs(...)(optional), .underline(...)(optional), .fill(...)(optional), .justified(...)(optional), .vertical(...)(optional), .tag(...)(optional), .class(...)(optional), .attributes(...)(optional), .children(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of NavProps.