FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    StyleBuilder

    struct · ferroui-view · v0.5.0

    struct StyleBuilder
    

    A style being built: a selector, setters and nested styles. Turns into a Style of the styles API of the port (build), or is given to an element (styles: [..] in rsx!, .styles([..])).

    style("Button.accent")
        .set(Button::background_property(), "#0063B1")
        .set(Button::foreground_property(), "White")
        .nested(style("^:pointerover").set(Button::opacity_property(), 0.9))
    

    View source

    Members

    set

    fn set<P: TypedProperty + ?Sized>(self: Self, property: &'static P, value: impl IntoValue<<P as >::Value>) -> Self
    

    Sets property to value (what converts to its value: "Red" for a brush, 8.0 for a thickness).

    Source

    nested

    fn nested(self: Self, style: StyleBuilder) -> Self
    

    Adds a nested style, whose selector starts with ^ (the selector of this one): style("^:pointerover").

    Source

    build

    fn build(self: Self) -> Ref<Style>
    

    The style.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.