GitHunt
RU

rustunit/bevy_web_popups

Allows to trigger web/dom based popups/alerts and textinput in bevy

bevy_web_popups

crates.io
docs.rs
discord

Allows to trigger web/dom based popups/alerts and textinput in bevy using wasm-bindgen's web_sys.
It is fully customizable but comes with a batteries included default style (see demo below).

See the crate in action in TinyTakeoff:

demo

Features

  • window.alert()
  • popup dialog with background darkening, textinput, cancel and ok button (fully customizable)

Usage

Add dependency: cargo add bevy_web_popups

Initialize Bevy Plugin:

// request initialisation right on startup
app.add_plugins(WebAlertsPlugin);
app.observe(on_event);
fn bevy_system() {
    // trigger native browser alert message popup
    bevy_web_popups::alert("important msg");

    // trigger complex text input popup with a custom title, custom labels for the buttons and asking to spawn default css classes instead of specifying them ourselfs
    bevy_web_popups::show_textinput("set nickname:", "ok", "cancel", true);
}

// system processing events coming from the web plugin
fn on_event(
    trigger: Trigger<WebAlertResponse>,
) {
    let e = trigger.event()

    if let WebAlertResponse::InputOk(text) = e {
        info!("user confirmed with text: {text}");
    }
}

Our Other Crates

Bevy version support

bevy this crate
0.18 0.7,main
0.17 0.6
0.16 0.5
0.15 0.4
0.14 0.2,0.3
0.13 0.1

License

All code in this repository is dual-licensed under either:

at your option. This means you can select the license you prefer.

Your contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Languages

Rust93.9%Just6.1%

Contributors

Apache License 2.0
Created August 29, 2024
Updated January 15, 2026
rustunit/bevy_web_popups | GitHunt