pub fn top_app_bar() -> TopAppBarBuilderExpand description
§top_app_bar
Render a small or flexible top app bar for screen titles, navigation, and actions.
§Usage
Use as the primary top bar to show the current screen title and actions. Flexible variants grow to accommodate multiline titles and subtitles.
§Parameters
modifier— modifier chain applied to the surface.container_color— optional app bar surface color.content_color— optional default title color.elevation— optional surface elevation.content_padding— optional padding applied to app bar content.title— title text displayed in the bar.title_content— optional image, logo or custom title content replacing the title text while retaining the subtitle and alignment.title_area_modifier— modifier chain applied to the title and subtitle area.window_chrome— use this bar as the title bar when the window is configured withWindowConfig::with_app_titlebar.navigation_icon— optional leading icon slot.actions— trailing action slots.navigation_icon_color— optional color for the navigation icon slot.action_icon_color— optional color for trailing action slots.title_inset— optional total title inset when no navigation icon is present.actions_spacing— optional spacing inserted between action items.variant— small, medium flexible, or large flexible layout.subtitle— optional secondary text below the title.title_alignment— leading or globally centered title placement.scroll_state— shared height and overlap state also passed to the scroll provider.scrolled_container_color— optional container color when content scrolls under the bar.
§Examples
use tessera_components::{
app_bar::{TopAppBarVariant, top_app_bar},
button::button,
text::text,
};
use tessera_ui::{Callback, remember};
let unread = remember(|| 3usize);
let mark_read = Callback::new(move || unread.set(0));
top_app_bar()
.variant(TopAppBarVariant::MediumFlexible)
.title("Inbox")
.subtitle(format!("{} unread messages", unread.get()))
.action(move || {
button().text().on_click_shared(mark_read).child(|| {
text("Mark read");
});
});
mark_read.call();
assert_eq!(unread.get(), 0);