pub struct HeaderItem { /* private fields */ }Expand description
An iOS bar button for super::host::Screen::header_left_items and
super::host::Screen::header_right_items:
what it shows, an optional native menu of desktop::MenuItems, and
handlers that run when the platform reports their ids as the root’s
Menu event.
HeaderItem::system(HeaderSystemItem::Edit).on_press(edit)
HeaderItem::symbol_title("sparkles", "Upgrade").on_press(upgrade)
HeaderItem::symbol("ellipsis.circle")
.label("More")
.menu([
desktop::MenuItem::new("Share").on_select(share),
desktop::MenuItem::submenu("Danger", [
desktop::MenuItem::new("Delete").destructive(true).on_select(remove),
])
.inline(true),
])Implementations§
Source§impl HeaderItem
impl HeaderItem
Sourcepub fn system(item: HeaderSystemItem) -> Self
pub fn system(item: HeaderSystemItem) -> Self
A system-item button.
Sourcepub fn symbol_title(
name: impl Into<Arc<str>>,
title: impl Into<Arc<str>>,
) -> Self
pub fn symbol_title( name: impl Into<Arc<str>>, title: impl Into<Arc<str>>, ) -> Self
A button showing an SF Symbol and title after it; VoiceOver reads
the title unless Self::label is set.
Sourcepub fn key(self, key: impl Into<Arc<str>>) -> Self
pub fn key(self, key: impl Into<Arc<str>>) -> Self
Optional key for keeping a UIBarButtonItem across updates; also
the button’s accessibility identifier, which tests name it by
(id:<key>).
Sourcepub fn label(self, label: impl Into<Arc<str>>) -> Self
pub fn label(self, label: impl Into<Arc<str>>) -> Self
VoiceOver’s label when the content is a system item or symbol.
Whether the button shares its background with the bar buttons next
to it (default true): on iOS 26 and later, false gives it a glass
capsule of its own instead of the one its neighbors share
(UIBarButtonItem.sharesBackground). Earlier iOS versions ignore
it.
Sourcepub fn on_press(self, f: impl Fn() + 'static) -> Self
pub fn on_press(self, f: impl Fn() + 'static) -> Self
Runs f when the button is pressed and it has no menu.
Opens this native menu on press (the button’s Self::on_press is
unused while a menu is set).
Trait Implementations§
Source§impl Clone for HeaderItem
impl Clone for HeaderItem
Source§impl Debug for HeaderItem
impl Debug for HeaderItem
Source§impl IntoReactive<HeaderItem> for HeaderItem
impl IntoReactive<HeaderItem> for HeaderItem
Source§fn into_reactive(self) -> Reactive<HeaderItem>
fn into_reactive(self) -> Reactive<HeaderItem>
Reactive.