dioxus_html::elements

Module script

Source
Expand description

Build a <script> element.

The script HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code. The script element can also be used with other languages, such as WebGL’s GLSL shader programming language and JSON.

§Usage in rsx

rsx! {
    // Elements are followed by braces that surround any attributes and children for that element
    script {
        // Add any attributes first
        class: "my-class",
        "custom-attribute-name": "value",
        // Then add any attributes you are spreading into this element
        ..attributes,
        // Then add any children elements, components, text nodes, or raw expressions
        div {}
        ChildComponent {}
        "child text"
        {raw_expression}
    }
};

Constants§