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 text(label: impl Into<String>) -> Self
pub fn text(label: impl Into<String>) -> Self
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 disabled(self, disabled: bool) -> Self
pub fn disabled(self, disabled: bool) -> Self
Dims the item and takes it out of clicks and of keyboard focus.
Sourcepub fn count(self, count: impl Into<String>) -> Self
pub fn count(self, count: impl Into<String>) -> Self
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) -> Self
pub fn badge(self, badge: Badge) -> Self
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>) -> Self
pub fn shortcut(self, keys: impl Into<String>) -> Self
Shows the keys that do the same, at the end of the row.
Sourcepub fn on_click(self, handler: impl Fn() + 'static) -> Self
pub fn on_click(self, handler: impl Fn() + 'static) -> Self
Runs handler when the item is clicked.
Sourcepub fn action(self, action: impl View + 'static) -> Self
pub fn action(self, action: impl View + 'static) -> Self
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) -> Self
pub fn item(self, item: SidebarItem) -> Self
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) -> Self
pub fn expanded(self, expanded: bool) -> Self
Whether the submenu starts unfolded. By default, only if it holds the selected item.
Sourcepub fn expanded_binding(self, expanded: Binding<bool>) -> Self
pub fn expanded_binding(self, expanded: Binding<bool>) -> Self
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§
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<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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.