Function sauron_core::html::attributes::classes_flag[][src]

pub fn classes_flag<P, S, MSG>(pair: P) -> Attribute<MSG> where
    P: AsRef<[(S, bool)]>,
    S: ToString
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),
   ]);