logo
pub fn classes_flag<MSG>(
    pair: impl IntoIterator<Item = (impl ToString, bool)>
) -> Attribute<&'static str, &'static str, AttributeValue<MSG>>
Expand description

A helper function which takes an array of tuple of class and a flag. The final class is assembled using only the values that has a flag which evaluates to true.

Examples

use sauron::prelude::*;
let is_hidden = true;
let has_error = true;

let line:Attribute<()> = classes_flag([
       ("dashed", is_hidden),
       ("error", has_error),
   ]);