Reference

Icon

One of the built-in SVG icons, rendered inline.

Icon(_ name: String, size: Enum, tone: Enum, muted: Bool)

Before 5.0

name

size

tone

Deployed

2 warnings

1 failed

Queued

Example

wf

Row(gap: .lg, align: .center) { Row(gap: .xs, align: .center) { Icon("check").success Text("Deployed") } Row(gap: .xs, align: .center) { Icon("warning").warning Text("2 warnings") } Row(gap: .xs, align: .center) { Icon("alert-circle").danger Text("1 failed") } Row(gap: .xs, align: .center) { Icon("clock").muted Text("Queued") } }

Sizes

wf

Row(gap: .md, align: .center) { Icon("star").sm Icon("star") Icon("star").lg.primary }

Beside a button's words

wf

Button("Download report") { Icon("download") Text("Download report") }

Props

Props of Icon
PropTypeUnsetMeaning

name

String (positional)

—

One of the 83 built-in icon names (home, search, chevron-down …), drawn inline as SVG; another is V08 and draws nothing

size:

one of its cases

md

How large it is, against the text around it. Written as a flag, .sm, or by name, size: .sm.

  • .sm: font-size-sm (0.875rem)
  • .md (the default): The text's own size, 1em (the default)
  • .lg: font-size-xl

tone:

one of its cases

none: the text's colour

Its colour, a tone of the theme. Written as a flag, .primary, or by name, tone: .primary.

  • .primary: The theme's primary colour
  • .secondary: The theme's secondary colour
  • .success: Green: done, healthy
  • .danger: Red: destructive, failed
  • .warning: Amber: needs attention
  • .info: Blue: a neutral notice

muted:

Bool

false

In color-text-muted, for something secondary. Written as a flag, .muted, or muted: true.

Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

.sm

.md

.lg

.primary

.secondary

.success

.danger

.warning

.info

.muted

Events

Every element also takes the props, the events and the attribute families listed on every element.

Slots

It takes no slots.

Renders with the class wf-icon, stable across releases, so a stylesheet may target it.