Type Alias AttrGroup

Source
pub type AttrGroup = BTreeMap<String, AttrGroupValue>;
Expand description

Type interpreted as component’s dynamic attributes groups

Be careful when using dynamic attributes, key-value type compatibility is checked in runtime (errors logged into JS console) or ignored for AttrValue variant.

use vertigo::{bind, component, dom, AttrGroup, Value};

#[component]
pub fn Input(value: Value<String>, input: AttrGroup) {
    let on_input = bind!(value, |new_value: String| {
        value.set(new_value);
    });

    dom! {
        <input {value} {on_input} {..input} />
    }
}

let value = Value::new("world".to_string());

dom! {
    <div>
       <Input {value} input:name="hello_value" input:id="my_input_1" />
    </div>
};

Aliased Type§

pub struct AttrGroup { /* private fields */ }