Skip to main content

SVG

The SVG widget displays vector graphics (SVG) that keep their quality however far you scale them up or down.
Use it for images that must stay sharp at any size, such as icons, logos, and illustrations.

Definition and role

The SVG widget loads SVGs from a range of sources — assets, the network, files, and strings — and renders them. Tint the whole SVG with color, adjust how it fits its area with fit, and set its alignment. Animated SVGs respond to play, pause, and stop. If the source is empty or can't be found, a placeholder image appears instead.

  • Category: Contents
  • Default state: shows a placeholder image when the source is empty

Features

FeatureDescription
Vector renderingRenders sharply at any size. Scaling up or down never degrades quality.
Source loadingLoads an SVG from an asset, the network, a file, or a string.
Color tintingApplies a color across the whole SVG with color and colorBlendMode.
Fit and alignmentUse fit and alignment to control how the SVG sits inside its area.
AnimationTurn on animated to play an animated SVG, and use repeat to control looping.
PlaceholderShows the placeholder image when there is no source or the load fails.

How to use

  1. Open the Contents category in the left widget palette.
  2. Drag the SVG item onto the canvas.
  3. In the properties panel on the right, set the SVG source to display.
  4. Adjust the color (color), fit (fit), and size (Size) as needed.
  5. For an animated SVG, turn on animated and use repeat to decide whether it loops.

Properties

PropertyDescriptionDefaultValue / Type
svgLoaderSVG source to display (asset, network, file, string, and more)Empty sourceSVG loader
placeholderName of the fallback image shown when there is no sourceNot setString (asset name)
SizeWidget size - width and height (expand to edit width and height)Not setNumber (px)
fitHow the SVG fits inside its areacontainfill·contain·cover·fitWidth·fitHeight·none·scaleDown
alignmentAlignment inside the areacenterAlignment value
matchTextDirectionMirror horizontally to match text direction (RTL)falsetrue / false
allowDrawingOutsideViewBoxAllow drawing beyond the viewBoxfalsetrue / false
colorTint color laid over the SVGNot setColor
colorBlendModeHow color is composited onto the SVGsrcInBlend mode
semanticsLabelAccessibility (screen reader) labelNot setString
excludeFromSemanticsExclude from the accessibility treefalsetrue / false
clipBehaviorHow content outside the area is clippedhardEdgenone·hardEdge·antiAlias·antiAliasWithSaveLayer
cacheColorFilterWhether to cache the color filterfalsetrue / false
animatedWhether to play an animated SVGfalsetrue / false
repeatWhether the animation loops (when animated is on)truetrue / false

Notes and tips

tip

You set animated while authoring. An animated SVG plays only while it's on — leave it off for static SVGs and they cost nothing extra to render.

note

If the source is empty or the asset can't be found, the placeholder image you set appears instead — or the default placeholder when you haven't set one.

Learn more

tip

For the full set of Widget Controls (Property, Method, and Event) that drive this widget from a script, visit SVG Widget Control.