pub struct AppBar { /* private fields */ }Expand description
Top app bar with caller-owned navigation, headings, actions, and optional search.
Implementations§
Source§impl AppBar
impl AppBar
Sourcepub fn new(id: impl Into<ElementId>, title: impl Into<SharedString>) -> Self
pub fn new(id: impl Into<ElementId>, title: impl Into<SharedString>) -> Self
Creates a small top app bar with the given element ID and title.
Sourcepub fn variant(self, variant: AppBarVariant) -> Self
pub fn variant(self, variant: AppBarVariant) -> Self
Sets the app bar layout variant (default AppBarVariant::Small).
Sourcepub fn subtitle(self, subtitle: impl Into<SharedString>) -> Self
pub fn subtitle(self, subtitle: impl Into<SharedString>) -> Self
Sets the secondary subtitle text displayed beneath the title.
Sourcepub fn title_content(self, content: impl IntoElement + 'static) -> Self
pub fn title_content(self, content: impl IntoElement + 'static) -> Self
Replaces the visual title while keeping the constructor’s accessible name.
Sourcepub fn subtitle_content(self, content: impl IntoElement + 'static) -> Self
pub fn subtitle_content(self, content: impl IntoElement + 'static) -> Self
Replaces the subtitle with custom content.
Sourcepub fn title_for_rows<E: IntoElement>(
self,
build: impl FnOnce(bool) -> E + 'static,
) -> Self
pub fn title_for_rows<E: IntoElement>( self, build: impl FnOnce(bool) -> E + 'static, ) -> Self
Builds the title for the currently displayed row.
Sourcepub fn subtitle_for_rows<E: IntoElement>(
self,
build: impl FnOnce(bool) -> E + 'static,
) -> Self
pub fn subtitle_for_rows<E: IntoElement>( self, build: impl FnOnce(bool) -> E + 'static, ) -> Self
Builds the subtitle for the currently displayed row.
Sourcepub fn title_alignment(self, alignment: AppBarAlignment) -> Self
pub fn title_alignment(self, alignment: AppBarAlignment) -> Self
Overrides the logical horizontal alignment of the title.
Sourcepub fn subtitle_alignment(self, alignment: AppBarAlignment) -> Self
pub fn subtitle_alignment(self, alignment: AppBarAlignment) -> Self
Overrides the logical horizontal alignment of the subtitle.
Sourcepub fn title_max_lines(self, lines: usize) -> Self
pub fn title_max_lines(self, lines: usize) -> Self
Sets the maximum line count for plain title text (clamped to at least 1).
Sourcepub fn subtitle_max_lines(self, lines: usize) -> Self
pub fn subtitle_max_lines(self, lines: usize) -> Self
Sets the maximum line count for plain subtitle text (clamped to at least 1).
Places a leading navigation control (such as a back or menu button) at the start of the bar.
Sourcepub fn actions(self, element: impl IntoElement) -> Self
pub fn actions(self, element: impl IntoElement) -> Self
Places trailing action controls (such as an AppBarRow) at the end of the bar.
Sourcepub fn search(self, element: impl IntoElement) -> Self
pub fn search(self, element: impl IntoElement) -> Self
Supplies the search control that replaces the heading.
Sourcepub fn logo(self, element: impl IntoElement) -> Self
pub fn logo(self, element: impl IntoElement) -> Self
Places a brand logo element alongside the title.
Sourcepub fn second_row(self, element: impl IntoElement) -> Self
pub fn second_row(self, element: impl IntoElement) -> Self
Adds presentation content below the expanded heading in TwoRows.
Sourcepub fn colors(self, colors: AppBarColors) -> Self
pub fn colors(self, colors: AppBarColors) -> Self
Overrides container, heading, navigation, and action colors.
Sourcepub fn content_padding(self, padding: AppBarPadding) -> Self
pub fn content_padding(self, padding: AppBarPadding) -> Self
Sets explicit logical padding applied to each app bar row.
Sourcepub fn collapsed_height(self, height: Pixels) -> Self
pub fn collapsed_height(self, height: Pixels) -> Self
Overrides the collapsed height of the top row in logical pixels (default 64 px).
Sourcepub fn expanded_height(self, height: Pixels) -> Self
pub fn expanded_height(self, height: Pixels) -> Self
Overrides the fully expanded height of a two-row bar in logical pixels.
Sourcepub fn track_scroll(self, handle: &ScrollHandle) -> Self
pub fn track_scroll(self, handle: &ScrollHandle) -> Self
Links a GPUI ScrollHandle to drive scroll-under color and collapse behavior.
Sourcepub fn scroll_state(self, state: &Entity<AppBarScrollState>) -> Self
pub fn scroll_state(self, state: &Entity<AppBarScrollState>) -> Self
Binds a caller-owned AppBarScrollState entity for reading or controlling scroll collapse.
Sourcepub fn scroll_behavior(self, behavior: AppBarScrollBehavior) -> Self
pub fn scroll_behavior(self, behavior: AppBarScrollBehavior) -> Self
Sets how scrolling affects the app bar’s height (default AppBarScrollBehavior::Pinned).
Sourcepub fn scroll_enabled(self, enabled: bool) -> Self
pub fn scroll_enabled(self, enabled: bool) -> Self
Enables or disables scroll-driven collapse updates (default true).
Sourcepub fn scroll_motion(self, motion: MotionSpec) -> Self
pub fn scroll_motion(self, motion: MotionSpec) -> Self
Overrides motion when the caller asks the linked scroll state to settle.
Sourcepub fn font_scale(self, scale: f32) -> Self
pub fn font_scale(self, scale: f32) -> Self
Multiplies the heading typography scale by a positive finite factor (default 1.0).
Trait Implementations§
Source§impl IntoElement for AppBar
impl IntoElement for AppBar
Source§type Element = ViewElement<AppBar>
type Element = ViewElement<AppBar>
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 AppBar
impl RenderOnce for AppBar
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 AppBar
impl !Send for AppBar
impl !Sync for AppBar
impl !UnwindSafe for AppBar
impl Forget for AppBar
impl Freeze for AppBar
impl Move for AppBar
impl Unpin for AppBar
impl UnsafeUnpin for AppBar
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.