[−][src]Function sauron::prelude::html::attributes::styles_flag
pub fn styles_flag<V, MSG, P>(
trio: P
) -> Attribute<&'static str, &'static str, AttributeValue, Event, MSG> where
P: AsRef<[(&'static str, V, bool)]>,
V: Into<Value> + Clone,
A helper function which creates a style attribute by assembling only the parts that passed the boolean flag
ⓘThis example is not tested
styles_flag([ ("display", "block", self.is_active), ("display", "none", !self.is_active), ]),
This could also be written as
ⓘThis example is not tested
styles([("display", if self.is_active { "block" }else{ "none" })])