GLink

A customizable hyperlink widget with hover and press animations, configurable colors, text properties, and cursor behavior.

Example

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

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

    GLinkExample = <ScrollYView>{
        height: 200.0,
        width: Fill,
        spacing: 10.0,
        flow: Down,
        <GLabel>{
            text: "GLink"
        }
        <GLink>{
            text: "Link",
        }
        <GLink>{
            theme: Dark,
            text: "Theme Dark",
        }
        <GLink>{
            theme: Error,
            text: "Define hover color and pressed color",
            hover_color: #FF00FF,
            pressed_color: #00FF00,
        }
        <GLink>{
            theme: Success,
            text: "No underline",
            underline: false,
        }
        <GLink>{
            theme: Warning,
            text: "Custom More",
            font_size: 14.0,
            hover_color: #FF00FF,
            background_color: #00FF00,
            margin: 10.0,
            padding: 10.0,
            color: #FF0000,
            underline_width: 2.0,
            font_family: dep("E:/Rust/try/makepad/Gen-UI/examples/gen_widget_example/resources/GoNotoKurrent-Bold.ttf"),
        }
        
    }
}
}

Props

decoratenametypedescription
livethemeThemesThe theme applied to the link.
livebackground_colorOption<Vec4>The background color of the link.
livehover_colorOption<Vec4>The color of the link when hovered.
livepressed_colorOption<Vec4>The color of the link when pressed.
liveborder_colorOption<Vec4>The border color of the link.
liveunderlineboolWhether the link has an underline.
liveunderline_colorOption<Vec4>The color of the underline.
liveunderline_widthf32The width of the underline.
liveborder_radiusf32The radius of the link's border.
liveroundboolWhether the link has rounded borders.
livetransparentboolWhether the link background is transparent.
livetextRcStringMutThe text content of the link.
livefont_sizef64The size of the font used in the link.
livecolorOption<Vec4>The color of the text.
livefont_familyLiveDependencyThe font family of the text.
livecursorOption<MouseCursor>The cursor type when hovering over the link.
livehrefOption<String>The URL that the link points to.
livelink_typeLinkTypeThe type of the link (NewTab or SameTab).
livevisibleboolWhether the link is visible.
livedraw_textDrawGTextThe component used for drawing the text.
livetext_walkWalkThe positioning properties for the text.
livegrab_key_focusboolWhether the link grabs key focus when clicked.
animatoranimatorAnimatorThe animation properties for the link.
redrawdraw_linkDrawGLinkThe component used for drawing the link.
walkwalkWalkThe positioning properties for the link.
layoutlayoutLayoutThe layout properties for the link.

Event

namedescription
HoveredTriggered when the link is hovered.
ClickedTriggered when the link is clicked.
ReleasedTriggered when the link is released.
PressedTriggered when the link is pressed.