svg

Display icon files with the suffix .svg

Example

Basic usage

Make sure the icon address exists before use. Use the dep built-in function to point to the icon address. This function can use an absolute address. In the following example, crate://self/ represents the project root directory.

1<svg src="dep('crate://self/resources/genui.svg')"></svg>

Attributes

NameDescriptionType
themeThemeThemes
brightnessBrightnessF32
curveCurveF32
linearizeLinearizeF32
srcSVG resource pathLiveDependency
scaleScaleF64
colorColorMakepadColor
draw_depthDraw depthF32
stroke_hover_colorStroke color when hoveringMakepadColor
stroke_focus_colorStroke color when focusedMakepadColor
cursorMouse pointer styleMouseCursor
grab_key_focusCapture keyboard focusbool
visibleVisiblebool
animation_keyAnimation keybool
abs_posAbsolute positionDVec2
marginMarginMargin
widthWidthSize
heightHeightSize
scrollScroll offsetDVec2
clip_xClip X axisbool
clip_yClip Y axisbool
paddingPaddingPadding
alignAlignmentAlign
flowFlow modeFlow
spacingSpacingF64
event_keyEvent keybool

Event callback

NameDescriptionParameters
clickedClick eventGSvgClickedParam
hover_inMouse hover eventGSvgHoverParam
hover_outMouse out eventGSvgHoverParam
focusFocus eventGSvgFocusParam
focus_lostLost focus eventGSvgFocusLostParam