pub struct NavigationItem {
pub label: Text,
pub target: NavTarget,
pub order: i32,
pub icon: Option<IconData>,
pub group: Option<Text>,
pub badge: Option<String>,
}Expand description
A sidebar entry: a resource’s, from its ResourceDef, or a Page’s.
Fields§
§label: TextThe entry’s text.
target: NavTargetWhere this entry points.
order: i32Sort key for the sidebar.
icon: Option<IconData>The icon before the label, if any.
group: Option<Text>The labelled sidebar group the entry renders in; None renders it with the ungrouped
entries, above every group.
badge: Option<String>The text of the badge after the label, if any.
Implementations§
Sourcepub fn at(label: impl Into<Text>, url: impl Into<String>) -> Self
pub fn at(label: impl Into<Text>, url: impl Into<String>) -> Self
A sidebar entry at an explicit url, kept as written.
The entry whose URL is the longest match for the current path is marked active. Of the entries sharing that path, the one whose query the request carries wins, then the one naming more of that query, then the first declared.
Sourcepub fn group(self, group: impl Into<Text>) -> Self
pub fn group(self, group: impl Into<Text>) -> Self
This entry in the sidebar group labelled group. Groups render in the order of their
first entry, after the ungrouped entries.
Sourcepub fn badge(self, text: impl Into<String>) -> Self
pub fn badge(self, text: impl Into<String>) -> Self
This entry with a badge reading text after its label, such as "New"; a blank text
is ignored. A resource’s navigation_badge counts
its rows for one instead.
Sourcepub fn is_current_path(&self, current_path: &str) -> bool
pub fn is_current_path(&self, current_path: &str) -> bool
Whether this item is current for the given request path, which carries no query or fragment: an entry’s own are the state it points with, not part of where it points.