Function sauron::prelude::prelude::html::attributes::attrs_flag

source ·
pub fn attrs_flag<MSG>(
    trio: impl IntoIterator<Item = (&'static str, impl Into<Value>, bool)>
) -> impl IntoIterator<Item = Attribute<MSG>>
Expand description

A helper function for setting attributes with no values such as checked in checkbox input type This is best called to be appended to the node since this returns an array of attributes which doesn’t play well with the others

§Examples

use sauron::{*,html::*, html::attributes::attrs_flag};

let is_checked = true;
let html: Node<()> =
    input(vec![r#type("checkbox")], vec![]).with_attributes(attrs_flag(vec![(
                            "checked",
                            "checked",
                            is_checked,
                        )]));