pub struct NavigationDrawer { /* private fields */ }Expand description
Full-width Material 3 Navigation Drawer (360 dp default width) with Standard (docked) and Modal (side-sheet) presentations, sections, dividers, and 56 dp pill destination indicators.
Implementations§
Sourcepub const DEFAULT_WIDTH: Pixels
pub const DEFAULT_WIDTH: Pixels
Default Material 3 navigation drawer width (360 dp).
Sourcepub fn new(id: impl Into<ElementId>, items: NavigationItems) -> NavigationDrawer
pub fn new(id: impl Into<ElementId>, items: NavigationItems) -> NavigationDrawer
Creates a standard navigation drawer with the given element ID and controlled NavigationItems.
Sourcepub fn entries(
self,
entries: impl IntoIterator<Item = NavigationDrawerEntry>,
) -> NavigationDrawer
pub fn entries( self, entries: impl IntoIterator<Item = NavigationDrawerEntry>, ) -> NavigationDrawer
Appends ordered destination, header, or divider entries to the drawer list.
Sourcepub fn section(
self,
header: impl Into<SharedString>,
items: impl IntoIterator<Item = NavigationItem>,
) -> NavigationDrawer
pub fn section( self, header: impl Into<SharedString>, items: impl IntoIterator<Item = NavigationItem>, ) -> NavigationDrawer
Appends a section heading followed by its navigation items.
Sourcepub fn push_section(self, section: NavigationDrawerSection) -> NavigationDrawer
pub fn push_section(self, section: NavigationDrawerSection) -> NavigationDrawer
Appends a NavigationDrawerSection with an optional header and its items.
Sourcepub fn divider(self) -> NavigationDrawer
pub fn divider(self) -> NavigationDrawer
Appends a horizontal divider entry to the ordered entries list.
Sourcepub fn divider_before(
self,
item_id: impl Into<SharedString>,
) -> NavigationDrawer
pub fn divider_before( self, item_id: impl Into<SharedString>, ) -> NavigationDrawer
Inserts a horizontal divider immediately before the destination with matching item_id.
Sourcepub fn mode(self, mode: NavigationDrawerMode) -> NavigationDrawer
pub fn mode(self, mode: NavigationDrawerMode) -> NavigationDrawer
Chooses Standard (docked, default) or Modal (side-sheet overlay) mode.
Sourcepub fn width(self, width: Pixels) -> NavigationDrawer
pub fn width(self, width: Pixels) -> NavigationDrawer
Sets the drawer width in logical pixels (defaults to 360 dp, clamped to viewport).
Sourcepub fn headline(self, headline: impl Into<SharedString>) -> NavigationDrawer
pub fn headline(self, headline: impl Into<SharedString>) -> NavigationDrawer
Sets the drawer title displayed in Standard mode and used as the modal sheet’s accessible name.
Sourcepub fn header(self, header: impl IntoElement) -> NavigationDrawer
pub fn header(self, header: impl IntoElement) -> NavigationDrawer
Supplies custom header content above the destination list.
Supplies custom footer content anchored beneath the scrolling destination list.
Sourcepub fn shape(self, shape: CornerShape) -> NavigationDrawer
pub fn shape(self, shape: CornerShape) -> NavigationDrawer
Overrides the container corner shape.
Sourcepub fn colors(self, colors: NavigationDrawerColors) -> NavigationDrawer
pub fn colors(self, colors: NavigationDrawerColors) -> NavigationDrawer
Overrides container, content, header, divider, indicator, and modal scrim colors independently.
Sourcepub fn modal_state(self, state: &Entity<DialogState>) -> NavigationDrawer
pub fn modal_state(self, state: &Entity<DialogState>) -> NavigationDrawer
Attaches a caller-owned DialogState for NavigationDrawerMode::Modal.
Sourcepub fn modal_properties(self, properties: DialogProperties) -> NavigationDrawer
pub fn modal_properties(self, properties: DialogProperties) -> NavigationDrawer
Configures Escape and outside-click dismissal rules in Modal mode.
Sourcepub fn on_dismiss_request(
self,
callback: impl Fn(DialogCloseReason, &mut Window, &mut App) -> bool + 'static,
) -> NavigationDrawer
pub fn on_dismiss_request( self, callback: impl Fn(DialogCloseReason, &mut Window, &mut App) -> bool + 'static, ) -> NavigationDrawer
Intercepts user-initiated modal dismissal requests; return false to veto closing.
Sourcepub fn on_closed(
self,
callback: impl Fn(DialogCloseReason, &mut Window, &mut App) + 'static,
) -> NavigationDrawer
pub fn on_closed( self, callback: impl Fn(DialogCloseReason, &mut Window, &mut App) + 'static, ) -> NavigationDrawer
Invoked once when an accepted modal dismissal closes the drawer.
Trait Implementations§
Source§type Element = ViewElement<NavigationDrawer>
type Element = ViewElement<NavigationDrawer>
Source§fn into_element(self) -> <NavigationDrawer as IntoElement>::Element
fn into_element(self) -> <NavigationDrawer as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaterialElementExt for Twhere
T: IntoElement,
impl<T> MaterialElementExt for Twhere
T: IntoElement,
Source§fn badge_label(self, text: impl Into<SharedString>) -> Badge
fn badge_label(self, text: impl Into<SharedString>) -> Badge
Badge to this element’s upper trailing edge.Source§fn badge_count(self, count: usize, maximum: usize) -> Badge
fn badge_count(self, count: usize, maximum: usize) -> Badge
Badge to this element’s upper trailing edge.Source§fn tooltip(
self,
id: impl Into<ElementId>,
text: impl Into<SharedString>,
) -> Tooltip
fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip
Tooltip.Menu.Menu
whose items are built lazily only while the menu is open.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text for an image’s alternative text, which
stands in for what the element draws.