side_bar_provider

Function side_bar_provider 

Source
pub fn side_bar_provider(
    args: SideBarProviderArgs,
    state: SideBarProviderState,
    main_content: impl FnOnce() + Send + Sync + 'static,
    side_bar_content: impl FnOnce() + Send + Sync + 'static,
)
Expand description

Provides a side bar that slides in from the left, with a scrim overlay.

§Usage

Use as a top-level provider to display a navigation drawer or other contextual side content.

§Parameters

  • args — configures the side bar’s style and on_close_request callback; see SideBarProviderArgs.
  • state — a clonable SideBarProviderState to manage the open/closed state.
  • main_content — a closure that renders the main UI, which is visible behind the side bar.
  • side_bar_content — a closure that renders the content of the side bar itself.

§Examples

use tessera_ui_basic_components::side_bar::SideBarProviderState;

let state = SideBarProviderState::new();
assert!(!state.is_open());

state.open();
assert!(state.is_open());

state.close();
assert!(!state.is_open());