Skip to main content

scaffold

Function scaffold 

Source
pub fn scaffold() -> ScaffoldBuilder
Expand description

§scaffold

Layout top/bottom bars with floating content for app screens with persistent actions.

§Usage

Use for screens with app bars, floating actions, and transient messages.

§Parameters

  • modifier — optional modifier chain applied to the scaffold container.
  • window_insets — optional window insets applied to all slots after subtracting insets consumed by ancestors. Use WindowInsets::SafeDrawing for a window-sized scaffold.
  • container_color — optional background color that extends under the insets. With window insets and a theme, defaults to the theme’s surface.
  • content_padding — optional padding applied around the content area.
  • content — optional main content slot.
  • top_bar — optional top bar slot.
  • bottom_bar — optional bottom bar slot.
  • floating_action_button — optional floating action button slot.
  • floating_action_button_alignment — optional floating action button alignment.
  • floating_action_button_offset — additional x/y offset applied to the floating action button, defaulting to 0dp.
  • snackbar_host — optional snackbar host slot.
  • snackbar_alignment — optional snackbar host alignment.
  • snackbar_offset — additional x/y offset applied to the snackbar host, defaulting to 0dp.

§Examples

use tessera_components::app_bar::top_app_bar;
use tessera_components::scaffold::scaffold;
use tessera_components::text::text;
use tessera_components::theme::{MaterialTheme, material_theme};
use tessera_ui::tessera;

#[tessera]
fn demo() {
    material_theme()
        .theme(|| MaterialTheme::default())
        .child(|| {
            scaffold()
                .top_bar(|| {
                    top_app_bar().title("Inbox");
                })
                .content(|| {
                    text("Hello scaffold");
                });
        });
}