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 new(name: String, style: String) -> Self
pub fn new(name: String, style: String) -> Self
Creates a new CSS class with the given name and style declarations.
Automatically injects the styles into the DOM upon creation.
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.
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
AttributeValue, wrapping signals
for reactive updates or converting static values to text.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
AttributeValue, wrapping signals
for reactive updates or converting static values to text.