GIcon

A customizable icon widget that supports various visual properties and animation states.

Example

#![allow(unused)]
fn main() {
use makepad_widgets::*;

live_design! {
    import makepad_widgets::base::*;
    import makepad_widgets::theme_desktop_dark::*; 
    import gen_components::components::*;

    GIconExample = <ScrollYView>{
        height: 200.0,
        width: Fill,
        spacing: 10.0,
        flow: Down,
        <GLabel>{
            text: "GIcon",
        }
        <GIcon>{
            cursor: Help,
            src: dep("crate://self/resources/lightning.svg"),
        }
        <GIcon>{
            theme: Dark,
            src: dep("crate://self/resources/config.svg"),
        }
        <GIcon>{
            theme: Error,
            src: dep("crate://self/resources/lightning.svg"),
        }
        <GIcon>{
            theme: Warning,
            src: dep("crate://self/resources/lightning.svg"),
        }
        <GIcon>{
            height: 60,
            width: 160,
            cursor: Help,
            color: #fff,
            src: dep("crate://self/resources/logo_makepad.svg"),
        }
        
    }
}
}

Props

decoratenametypedescription
livethemeThemesThe theme applied to the icon.
livebrightnessf32The brightness of the icon.
livecurvef32The curve effect applied to the icon.
livelinearizef32The linearization factor of the icon.
livesrcLiveDependencyThe source dependency for the icon's image.
livecommandOption<String>The SVG path command (TODO).
livescalef64The scale of the icon.
livecolorOption<Vec4>The color of the icon.
livedraw_depthf32The drawing depth of the icon.
livehover_colorOption<Vec4>The color of the icon when hovered.
livecursorOption<MouseCursor>The cursor type when hovering over the icon.
livevisibleboolVisibility of the icon.
animatoranimatorAnimatorThe animation properties for the icon.
redrawdraw_iconDrawGIconThe component used for drawing the icon.
walkwalkWalkThe positioning properties for the icon.
layoutlayoutLayoutThe layout properties for the icon.

Event

namedescription
ClickedTriggered when the icon is clicked.
HoverTriggered when the icon is hovered.

Note: Events with None are omitted.