Skip to main content

floating_action_button_menu

Function floating_action_button_menu 

Source
pub fn floating_action_button_menu() -> FloatingActionButtonMenuBuilder
Expand description

§floating_action_button_menu

Overlay related primary actions above a floating action button.

§Usage

Offer two to six related creation actions while retaining the page beneath them.

§Parameters

  • state — optional shared visibility state; otherwise stored internally.
  • items — action labels, optional icons, and callbacks; missing callbacks disable actions.
  • main_content — page content beneath the menu, preserved across visibility changes.
  • modifier — size and placement of the entire menu host.
  • alignment — bottom start or bottom end, inset by 16dp.
  • color — primary, secondary, or tertiary theme colors.
  • scrim_color — optional overlay color; transparent by default.
  • enabled — whether the toggle and actions accept input.
  • open_label, close_label — localized accessible names for the toggle.

§Examples

use tessera_components::floating_action_button_menu::{
    FloatingActionButtonMenuState, floating_action_button_menu,
};
use tessera_ui::{remember, tessera};

let mut visibility = FloatingActionButtonMenuState::new();
assert!(!visibility.is_expanded());
visibility.open();
assert!(visibility.is_expanded());
visibility.close();
assert!(!visibility.is_expanded());

#[tessera]
fn creation_actions() {
    let state = remember(FloatingActionButtonMenuState::new);
    floating_action_button_menu().state(state);
}