Skip to main content

BackButton

Function BackButton 

Source
pub fn BackButton<F>(props: BackButtonProps<F>) -> impl IntoView
where F: Fn() + Clone + 'static,
Available on crate feature leptos only.
Expand description

Leptos component for the native back button.

Mirrors the React SDK’s BackButton ergonomics. Drives WebApp.BackButton: shows/hides it based on the visible signal, registers the optional click callback, and cleans both up on unmount.

§Examples

use leptos::prelude::*;
use telegram_webapp_sdk::leptos::BackButton;

#[component]
fn App() -> impl IntoView {
    let visible = RwSignal::new(true);
    view! {
        <BackButton
            visible=visible
            on_click=move || { web_sys::console::log_1(&"back".into()); }
        />
    }
}

§Required Props

§Optional Props

  • on_click: [F]
    • Optional callback invoked when the back button is clicked.