pub struct SidebarItem { /* private fields */ }Expand description
A sidebar row with an icon, a label, an optional count or badge, actions and a submenu.
Implementations§
Source§impl SidebarItem
impl SidebarItem
Sourcepub fn new(icon: IconName, label: impl Into<String>) -> SidebarItem
pub fn new(icon: IconName, label: impl Into<String>) -> SidebarItem
An item with this icon and label.
Sourcepub fn text(label: impl Into<String>) -> SidebarItem
pub fn text(label: impl Into<String>) -> SidebarItem
An item with only a label, the usual entry of a submenu. Reduced to icons, its first letter stands in for the icon.
Sourcepub fn selected(self, selected: bool) -> SidebarItem
pub fn selected(self, selected: bool) -> SidebarItem
Highlights the item as the current location.
Sourcepub fn disabled(self, disabled: bool) -> SidebarItem
pub fn disabled(self, disabled: bool) -> SidebarItem
Dims the item and takes it out of clicks and of keyboard focus.
Sourcepub fn count(self, count: impl Into<String>) -> SidebarItem
pub fn count(self, count: impl Into<String>) -> SidebarItem
A count badge at the end of the row (e.g. unread items). Reduced to icons, a dot on the icon stands for it, and screen readers read it.
Sourcepub fn badge(self, badge: Badge) -> SidebarItem
pub fn badge(self, badge: Badge) -> SidebarItem
A Badge at the end of the row, treated like Self::count: for a
tone or a word such as “New”.
Sourcepub fn shortcut(self, keys: impl Into<String>) -> SidebarItem
pub fn shortcut(self, keys: impl Into<String>) -> SidebarItem
Shows the keys that do the same, at the end of the row.
Sourcepub fn compact(self) -> SidebarItem
pub fn compact(self) -> SidebarItem
A denser row (32 px, callout text) for panels with many items.
Sourcepub fn on_click(self, handler: impl Fn() + 'static) -> SidebarItem
pub fn on_click(self, handler: impl Fn() + 'static) -> SidebarItem
Runs handler when the item is clicked.
Sourcepub fn action(self, action: impl View + 'static) -> SidebarItem
pub fn action(self, action: impl View + 'static) -> SidebarItem
Adds a control at the end of the row, beside its button: usually a small
IconButton with a label, or a DropdownMenu.
Hidden when reduced to icons.
Sourcepub fn item(self, item: SidebarItem) -> SidebarItem
pub fn item(self, item: SidebarItem) -> SidebarItem
Adds a row to the submenu that unfolds under this one. Clicking this row folds and unfolds it; reduced to icons, clicking it opens the sidebar too.
Sourcepub fn expanded(self, expanded: bool) -> SidebarItem
pub fn expanded(self, expanded: bool) -> SidebarItem
Whether the submenu starts unfolded. By default, only if it holds the selected item.
Sourcepub fn expanded_binding(self, expanded: Binding<bool>) -> SidebarItem
pub fn expanded_binding(self, expanded: Binding<bool>) -> SidebarItem
Reads and writes whether the submenu is unfolded from the app.
Trait Implementations§
Source§impl Debug for SidebarItem
impl Debug for SidebarItem
Auto Trait Implementations§
impl !RefUnwindSafe for SidebarItem
impl !Send for SidebarItem
impl !Sync for SidebarItem
impl !UnwindSafe for SidebarItem
impl Freeze for SidebarItem
impl Unpin for SidebarItem
impl UnsafeUnpin for SidebarItem
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.