pub struct Toolbar { /* private fields */ }Expand description
A floating or docked group of labeled actions with optional adjacent FAB. Supply a bounded main-axis extent for scrollable overflow. The toolbar reveals the focused action even when its scroll container is narrower.
Implementations§
Source§impl Toolbar
impl Toolbar
Sourcepub fn new(
id: impl Into<ElementId>,
label: impl Into<SharedString>,
actions: impl IntoIterator<Item = ToolbarAction>,
) -> Toolbar
pub fn new( id: impl Into<ElementId>, label: impl Into<SharedString>, actions: impl IntoIterator<Item = ToolbarAction>, ) -> Toolbar
Creates a floating horizontal toolbar with an element id, accessible label, and actions.
Sourcepub fn placement(self, placement: ToolbarPlacement) -> Toolbar
pub fn placement(self, placement: ToolbarPlacement) -> Toolbar
Sets whether the toolbar renders as ToolbarPlacement::Floating or ToolbarPlacement::Docked.
Sourcepub fn orientation(self, orientation: ToolbarOrientation) -> Toolbar
pub fn orientation(self, orientation: ToolbarOrientation) -> Toolbar
Sets the primary layout axis (ToolbarOrientation::Horizontal or ToolbarOrientation::Vertical).
Sourcepub fn color(self, color: ToolbarColor) -> Toolbar
pub fn color(self, color: ToolbarColor) -> Toolbar
Sets the Material 3 color treatment (ToolbarColor::Standard or ToolbarColor::Vibrant).
Sourcepub fn fab(
self,
position: ToolbarFabPosition,
label: impl Into<SharedString>,
icon: IconName,
invoke: impl Fn(&mut Window, &mut App) + 'static,
) -> Toolbar
pub fn fab( self, position: ToolbarFabPosition, label: impl Into<SharedString>, icon: IconName, invoke: impl Fn(&mut Window, &mut App) + 'static, ) -> Toolbar
Adds an adjacent FAB to a floating toolbar. Add the primary action through the action list when it belongs inside a docked toolbar.
Sourcepub fn fab_content(
self,
position: ToolbarFabPosition,
element: impl IntoElement,
) -> Toolbar
pub fn fab_content( self, position: ToolbarFabPosition, element: impl IntoElement, ) -> Toolbar
Uses a caller-authored adjacent control in a floating toolbar.
Sourcepub fn fab_color(self, color: FabColor) -> Toolbar
pub fn fab_color(self, color: FabColor) -> Toolbar
Overrides the adjacent FAB’s Material color role preset.
Sourcepub fn fab_colors(self, colors: ButtonColors) -> Toolbar
pub fn fab_colors(self, colors: ButtonColors) -> Toolbar
Overrides individual container and content colors on the adjacent FAB.
Sourcepub fn content(self, element: impl IntoElement) -> Toolbar
pub fn content(self, element: impl IntoElement) -> Toolbar
Inserts arbitrary content before the generated actions.
Sourcepub fn leading_content(self, element: impl IntoElement) -> Toolbar
pub fn leading_content(self, element: impl IntoElement) -> Toolbar
Adds an expandable leading slot before the main toolbar content.
Sourcepub fn trailing_content(self, element: impl IntoElement) -> Toolbar
pub fn trailing_content(self, element: impl IntoElement) -> Toolbar
Adds an expandable trailing slot after the main toolbar content.
Sourcepub fn leading_expanded(self, expanded: bool) -> Toolbar
pub fn leading_expanded(self, expanded: bool) -> Toolbar
Overrides whether the leading slot is expanded independently of the toolbar’s expanded state.
Sourcepub fn trailing_expanded(self, expanded: bool) -> Toolbar
pub fn trailing_expanded(self, expanded: bool) -> Toolbar
Overrides whether the trailing slot is expanded independently of the toolbar’s expanded state.
Sourcepub fn arrangement(self, arrangement: ToolbarArrangement) -> Toolbar
pub fn arrangement(self, arrangement: ToolbarArrangement) -> Toolbar
Distributes free space in a horizontal docked toolbar.
Sourcepub fn spacing(self, spacing: Pixels) -> Toolbar
pub fn spacing(self, spacing: Pixels) -> Toolbar
Sets the gap between toolbar items in logical pixels. Defaults to 4px.
Sourcepub fn expanded_height(self, height: Pixels) -> Toolbar
pub fn expanded_height(self, height: Pixels) -> Toolbar
Sets the height of a horizontal docked toolbar.
Sourcepub fn padding(self, padding: ToolbarPadding) -> Toolbar
pub fn padding(self, padding: ToolbarPadding) -> Toolbar
Overrides the logical content padding inside the toolbar strip.
Sourcepub fn shape(self, shape: CornerShape) -> Toolbar
pub fn shape(self, shape: CornerShape) -> Toolbar
Overrides the corner shape of the toolbar strip.
Sourcepub fn elevations(self, elevations: ToolbarElevations) -> Toolbar
pub fn elevations(self, elevations: ToolbarElevations) -> Toolbar
Overrides the shadow elevations for expanded and collapsed states.
Sourcepub fn colors(self, colors: ToolbarColors) -> Toolbar
pub fn colors(self, colors: ToolbarColors) -> Toolbar
Overrides the toolbar’s container, content, and selected-action colors.
Sourcepub fn expanded(self, expanded: bool) -> Toolbar
pub fn expanded(self, expanded: bool) -> Toolbar
Controls whether secondary actions appear directly in the toolbar.
Sourcepub fn track_scroll(self, scroll: &ScrollHandle) -> Toolbar
pub fn track_scroll(self, scroll: &ScrollHandle) -> Toolbar
Uses the linked content’s vertical scroll offset to collapse and expand the toolbar after a 40 dp change in the scroll direction.
Sourcepub fn scroll_state(self, state: &Entity<ToolbarScrollState>) -> Toolbar
pub fn scroll_state(self, state: &Entity<ToolbarScrollState>) -> Toolbar
Attaches a caller-owned ToolbarScrollState entity for scroll-driven collapsing and exit.
Sourcepub fn scroll_behavior(self, behavior: ToolbarScrollBehavior) -> Toolbar
pub fn scroll_behavior(self, behavior: ToolbarScrollBehavior) -> Toolbar
Configures scroll thresholds, exit direction, and snap/fling motion.
Sourcepub fn transition_motion(self, motion: MotionSpec) -> Toolbar
pub fn transition_motion(self, motion: MotionSpec) -> Toolbar
Overrides the MotionSpec used for expanding and collapsing leading/trailing slots.
Renders the supplied navigation instead of the toolbar. Use this for a responsive region shared between navigation and contextual actions.
Sourcepub fn overflow_label(self, label: impl Into<SharedString>) -> Toolbar
pub fn overflow_label(self, label: impl Into<SharedString>) -> Toolbar
Sets the accessible label for the collapsed overflow trigger button. Defaults to "More actions".
Trait Implementations§
Source§impl IntoElement for Toolbar
impl IntoElement for Toolbar
Source§type Element = ViewElement<Toolbar>
type Element = ViewElement<Toolbar>
Source§fn into_element(self) -> <Toolbar as IntoElement>::Element
fn into_element(self) -> <Toolbar as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for Toolbar
impl RenderOnce for Toolbar
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§
impl !RefUnwindSafe for Toolbar
impl !Send for Toolbar
impl !Sync for Toolbar
impl !UnwindSafe for Toolbar
impl Forget for Toolbar
impl Freeze for Toolbar
impl Move for Toolbar
impl Unpin for Toolbar
impl UnsafeUnpin for Toolbar
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.