Widgets

/

content

Svg

An SVG from a URL. Without color it shows the file's own colours; with color its shape is filled with that colour (for one-colour icons and logos).

A logo from a file

Svg shows an SVG file at the size you give it. Without color it keeps the file's own colours.

LAYR
Row(
  .config(
    gap: 12
    yAlign: mid
  )
  Svg(
    .config(
      size: 40
      alt: 'LAYR'
      src: '/icon.svg'
    )
  )
  Text(
    .config(
      size: 20
      weight: semibold
    )
    .obj('LAYR')
  )
)

In the theme's colour

With color, the SVG's shape is filled with that colour, so a one-colour icon or logo follows the theme. Here the same file becomes a flat rounded square in the accent colour: the shape is the file's outline, the colour is yours.

LAYR
Row(
  .config(
    gap: 16
    yAlign: mid
  )
  Svg(
    .config(
      size: 40
      alt: 'LAYR'
      color: accent
      src: '/icon.svg'
    )
  )
  Svg(
    .config(
      size: 40
      alt: 'LAYR'
      color: teal
      src: '/icon.svg'
    )
  )
  Svg(
    .config(
      size: 40
      alt: 'LAYR'
      color: ink
      src: '/icon.svg'
    )
  )
)

Config keys

KeyTypeDefaultMeaning
srcsrcSVG URL.
alttxtText alternative.
colorcolorFills the SVG's shape with this colour.
w (width)len | fill | hugWidth: a length, fill (share the remaining space) or hug (fit content, default).
h (height)len | fill | hugHeight: a length, fill or hug (default).
size (s)sizeWidth and height together: size: 200 or size: (200, 120).
minW (minWidth)lenMinimum width.
maxW (maxWidth)lenMaximum width.
minH (minHeight)lenMinimum height.
maxH (maxHeight)lenMaximum height.
aspect (aspectRatio)numAspect ratio (width / height), e.g. 16/9.
margininsetsSpace outside the object: all(8), sym(x: 8, y: 4), only(top: 8).
opacitynumOpacity from 0 to 1.
hide (hidden)boolRemoves the object from layout and the accessibility tree.
shrinknum1Shrink priority when space runs out. Lower shrinks first; 0 never shrinks.
flexnum1Share of remaining space for fill sizes.
cursorauto | pointer | text | grab | grabbing | move | notAllowed | crosshair | nonePointer cursor.
className (class)txtExtra CSS class names: styling hooks for your own stylesheet (hover rules, third-party CSS).

Privacy

Cookies

Terms

Contact & grievances