pub struct Banner { /* private fields */ }Expand description
An in-flow, non-blocking Material 3 banner/callout surface.
Visibility is owned by the caller; Banner keeps no internal hidden state.
Implementations§
Source§impl Banner
impl Banner
Sourcepub fn new(id: impl Into<ElementId>, message: impl Into<SharedString>) -> Self
pub fn new(id: impl Into<ElementId>, message: impl Into<SharedString>) -> Self
Creates an in-flow banner with a stable element ID and message text.
Sourcepub fn title(self, title: impl Into<SharedString>) -> Self
pub fn title(self, title: impl Into<SharedString>) -> Self
Sets an optional bold title line above the message.
Sourcepub fn tone(self, tone: SemanticTone) -> Self
pub fn tone(self, tone: SemanticTone) -> Self
Applies a Material 3 semantic tone palette.
SemanticTone::Danger defaults to Role::Alert unless overridden via
Self::alert. Explicit Self::colors overrides always take precedence.
Sourcepub fn icon(self, icon: impl IntoElement) -> Self
pub fn icon(self, icon: impl IntoElement) -> Self
Sets an optional leading decorative icon tinted to the banner’s icon color.
Sourcepub fn action(
self,
label: impl Into<SharedString>,
handler: impl Fn(&mut Window, &mut App) + 'static,
) -> Self
pub fn action( self, label: impl Into<SharedString>, handler: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
Sets the primary banner action button, inheriting the banner’s semantic tone.
Sourcepub fn secondary_action(
self,
label: impl Into<SharedString>,
handler: impl Fn(&mut Window, &mut App) + 'static,
) -> Self
pub fn secondary_action( self, label: impl Into<SharedString>, handler: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
Sets an optional secondary banner action button, inheriting the banner’s semantic tone.
Sourcepub fn actions_content(self, element: impl IntoElement) -> Self
pub fn actions_content(self, element: impl IntoElement) -> Self
Supplies optional custom action controls in the banner’s action row.
Sourcepub fn on_dismiss(
self,
handler: impl Fn(&mut Window, &mut App) + 'static,
) -> Self
pub fn on_dismiss( self, handler: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
Adds a trailing close IconButton that invokes handler when activated.
Sourcepub fn dismiss_label(self, label: impl Into<SharedString>) -> Self
pub fn dismiss_label(self, label: impl Into<SharedString>) -> Self
Sets the accessible label for the optional dismiss button. Defaults to "Dismiss".
Sourcepub fn shape(self, shape: CornerShape) -> Self
pub fn shape(self, shape: CornerShape) -> Self
Sets the container corner shape. Defaults to CornerRole::Medium.
Sourcepub fn colors(self, colors: BannerColors) -> Self
pub fn colors(self, colors: BannerColors) -> Self
Overrides banner region colors. Explicit values always take precedence over .tone(...).
Sourcepub fn alert(self, alert: bool) -> Self
pub fn alert(self, alert: bool) -> Self
Explicitly chooses Role::Alert (true) or Role::Status (false).
When unset, SemanticTone::Danger uses Role::Alert and other tones use Role::Status.
Trait Implementations§
Source§impl IntoElement for Banner
impl IntoElement for Banner
Source§type Element = ViewElement<Banner>
type Element = ViewElement<Banner>
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§impl RenderOnce for Banner
impl RenderOnce for Banner
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 Banner
impl !Send for Banner
impl !Sync for Banner
impl !UnwindSafe for Banner
impl Forget for Banner
impl Freeze for Banner
impl Move for Banner
impl Unpin for Banner
impl UnsafeUnpin for Banner
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.