dioxus_lib::prelude::global_attributes

Constant prevent_default

source
pub const prevent_default: (&'static str, Option<&'static str>, bool);
๐Ÿ‘ŽDeprecated: This attribute does nothing. For most renderers, you should prefer calling [dioxus_core::Event::prevent_default] on the event instead. For liveview, you can use "onclick": (evt) => evt.prevent_default() to prevent the default action for this element.
Expand description

This attribute has been deprecated in favor of dioxus_core::Event::prevent_default

ยงUsage in rsx

โ“˜
let prevent_default = "value";

rsx! {
    // Attributes need to be under the element they modify
    div {
        // Attributes are followed by a colon and then the value of the attribute
        prevent_default: "value"
    }
    div {
        // Or you can use the shorthand syntax if you have a variable in scope that has the same name as the attribute
        prevent_default,
    }
};