pub struct NavigationRail { /* private fields */ }Expand description
Material wide navigation rail. The optional modal uses the side-sheet session.
Implementations§
Sourcepub fn new(id: impl Into<ElementId>, items: NavigationItems) -> Self
pub fn new(id: impl Into<ElementId>, items: NavigationItems) -> Self
Creates a collapsed navigation rail with the given element ID and controlled NavigationItems.
Sourcepub fn mode(self, mode: RailMode) -> Self
pub fn mode(self, mode: RailMode) -> Self
Sets the docked rail mode (default RailMode::Collapsed). Ignored when Self::state is bound.
Sourcepub fn state(self, state: &Entity<NavigationRailState>) -> Self
pub fn state(self, state: &Entity<NavigationRailState>) -> Self
Uses retained presentation and transitions in place of the supplied mode.
Sourcepub fn title(self, title: impl Into<SharedString>) -> Self
pub fn title(self, title: impl Into<SharedString>) -> Self
Sets the accessible title used for the rail and its optional modal sheet (default "Navigation").
Sourcepub fn header(self, header: impl IntoElement) -> Self
pub fn header(self, header: impl IntoElement) -> Self
Places a custom header element at the top of the rail (such as a menu toggle button).
Sourcepub fn fab(self, fab: impl IntoElement) -> Self
pub fn fab(self, fab: impl IntoElement) -> Self
Places a floating action button below the header.
Sourcepub fn expanded_width(self, width: Pixels) -> Self
pub fn expanded_width(self, width: Pixels) -> Self
Sets the expanded rail width in logical pixels, clamped to 220..=360 px (default 240 px).
Sourcepub fn destination_content<E: IntoElement + 'static>(
self,
build: impl FnOnce(RailMode) -> E + 'static,
) -> Self
pub fn destination_content<E: IntoElement + 'static>( self, build: impl FnOnce(RailMode) -> E + 'static, ) -> Self
Replaces the standard destination list. The caller owns its navigation semantics.
Sourcepub fn divider_after(
self,
destination: impl Into<SharedString>,
divider: impl IntoElement,
) -> Self
pub fn divider_after( self, destination: impl Into<SharedString>, divider: impl IntoElement, ) -> Self
Places a divider or separator after one standard destination.
Sourcepub fn arrangement(self, arrangement: NavigationRailArrangement) -> Self
pub fn arrangement(self, arrangement: NavigationRailArrangement) -> Self
Sets how destinations are vertically distributed within the rail (default NavigationRailArrangement::Start).
Sourcepub fn destination_spacing(self, spacing: Pixels) -> Self
pub fn destination_spacing(self, spacing: Pixels) -> Self
Sets the vertical gap between destinations in logical pixels (default 4 px).
Sourcepub fn content_padding(self, padding: NavigationRailPadding) -> Self
pub fn content_padding(self, padding: NavigationRailPadding) -> Self
Overrides the logical inner padding of the rail container.
Sourcepub fn header_spacing(self, spacing: Pixels) -> Self
pub fn header_spacing(self, spacing: Pixels) -> Self
Sets the vertical spacing below the header and FAB slots (default 4 px).
Sourcepub fn expanded_header_top_padding(self, padding: Pixels) -> Self
pub fn expanded_header_top_padding(self, padding: Pixels) -> Self
Sets extra top padding above the header when the rail is expanded.
Sourcepub fn shapes(self, shapes: NavigationRailShapes) -> Self
pub fn shapes(self, shapes: NavigationRailShapes) -> Self
Overrides corner shapes for collapsed, expanded, and modal presentations.
Sourcepub fn colors(self, colors: NavigationRailColors) -> Self
pub fn colors(self, colors: NavigationRailColors) -> Self
Overrides container, content, and modal scrim colors.
Sourcepub fn modal(self, state: &Entity<DialogState>) -> Self
pub fn modal(self, state: &Entity<DialogState>) -> Self
Uses DialogState for modal visibility and focus restoration.
Sourcepub fn modal_options(self, options: RailModalOptions) -> Self
pub fn modal_options(self, options: RailModalOptions) -> Self
Configures side-sheet presentation and dismissal policy for the modal rail.
Sourcepub fn on_dismiss_request(
self,
callback: impl Fn(DialogCloseReason, &mut Window, &mut App) -> bool + 'static,
) -> Self
pub fn on_dismiss_request( self, callback: impl Fn(DialogCloseReason, &mut Window, &mut App) -> bool + 'static, ) -> Self
Intercepts user-initiated modal dismissal requests; return false to veto closing.
Sourcepub fn on_modal_close(
self,
callback: impl Fn(DialogCloseReason, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_modal_close( self, callback: impl Fn(DialogCloseReason, &mut Window, &mut App) + 'static, ) -> Self
Invoked once when an accepted modal dismissal closes the rail sheet.
Trait Implementations§
Source§type Element = ViewElement<NavigationRail>
type Element = ViewElement<NavigationRail>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::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.