pub struct CssClass { /* private fields */ }Expand description
Represents a CSS class with a name and its style declarations.
Created by the class! macro and used in html! via the class: attribute.
When the renderer encounters a CssClass, it injects the styles into the
DOM’s <style> element on first use and applies the class name to the element.
Implementations§
Source§impl CssClass
Implementation of CssClass construction and style injection.
impl CssClass
Implementation of CssClass construction and style injection.
Sourcepub fn inject_style(&self)
pub fn inject_style(&self)
Injects this class’s styles into the DOM if not already present.
Creates a <style> element with id euv-css-injected on first call,
then appends the class rule. Subsequent calls for the same class name
are no-ops. On first creation, also injects global CSS keyframes
required by built-in animations.
§Panics
Panics if window() or document() is unavailable on the current platform.
Trait Implementations§
Source§impl Display for CssClass
Displays the CSS class name.
impl Display for CssClass
Displays the CSS class name.
This enables format!("{}", css_class) to produce the class name string,
which is required for reactive if conditions in class: attributes.
Source§impl IntoReactiveString for &'static CssClass
Converts a reference to a CssClass into its class name for reactive string storage.
impl IntoReactiveString for &'static CssClass
Converts a reference to a CssClass into its class name for reactive string storage.
Source§fn into_reactive_string(self) -> String
fn into_reactive_string(self) -> String
Source§impl IntoReactiveString for CssClass
Converts a CssClass into its class name for reactive string storage.
impl IntoReactiveString for CssClass
Converts a CssClass into its class name for reactive string storage.
Source§fn into_reactive_string(self) -> String
fn into_reactive_string(self) -> String
Source§impl IntoReactiveValue for &'static CssClass
Converts a reference to a CSS class into an attribute value by cloning.
impl IntoReactiveValue for &'static CssClass
Converts a reference to a CSS class into an attribute value by cloning.
Source§fn into_reactive_value(self) -> AttributeValue
fn into_reactive_value(self) -> AttributeValue
Converts this CSS class reference into an AttributeValue::Css by cloning.
§Returns
AttributeValue- A CSS class attribute value.
Source§impl IntoReactiveValue for CssClass
Converts a CSS class reference into an attribute value.
impl IntoReactiveValue for CssClass
Converts a CSS class reference into an attribute value.
Source§fn into_reactive_value(self) -> AttributeValue
fn into_reactive_value(self) -> AttributeValue
Converts this CSS class into an AttributeValue::Css.
§Returns
AttributeValue- A CSS class attribute value.