iconset / icon_def / icon

Full Lucide and Bootstrap Icons packs ship compiled into the binary — no runtime disk read, and only used icons land in the output sprite (_wdoc/icons.svg). Icons paint with currentColor, so colour follows the surrounding text or class.

An icon is a placeable block — a legal diagram / container child positioned by x / y like a rect. The same icon / icon_size / icon_pos / icon_class fields also make any box-like shape (rect / circle / container / process / decision / terminator) wear a badge.

Preview

Status: ready

Status: ready

Example

p "Status: :lucide.check: ready"
PropertyTypeRequiredDescription
nameidentifieryesIcon name (the label slot), optionally set.name (e.g. lucide.compass).
setidentifiernoWhich declared iconset to read from (when more than one).
sizeutf8noIcon size, as on an iconset.
colorutf8noForeground colour, as on an iconset.
fillutf8noFill override, as on an iconset.
backgroundutf8noBackground override, as on an iconset.
classlist<utf8>noStyle classes, as on an iconset.
ididentifiernoOptional explicit HTML id.
xf64noTop-left placement (or use anchors).
yf64noTop-left placement (or use anchors).
widthf64noSize in diagram units (default 24×24).
heightf64noSize in diagram units (default 24×24).
scalef64noExtra multiplier on the size.
anchor_leftf64noDiagram anchor insets, like any shape.
connect_pointslist<AnchorSide>noDiagram edge-attach sides, like any shape.

§ 1Three ways to use an icon

Inline as a :lucide.check: pattern in a p or span; as a placeable icon block (a legal diagram / container child, positioned by x / y like a rect); or as a badge on a box-like shape (rect / circle / container / process / decision / terminator) via icon / icon_size / icon_pos / icon_class.

Inline, a bare :lucide.check: pattern reads from the named pack and flows with the prose:

A placeable icon block sits inside a diagram, positioned like any other shape; add it as a badge with icon / icon_pos on a shape:

Preview

Example

diagram {
  width = 80
  height = 80
  icon {
    name = "lucide.compass"
    x = 10.0
    y = 10.0
    width = 60.0
    height = 60.0
  }
}

Preview

Validate
Validate

Example

diagram {
  width = 160
  height = 80
  process "Validate" {
    id = v
    x = 20.0
    y = 15.0
    width = 120.0
    height = 50.0
    icon = "lucide.shield-check"
    icon_pos = :top_right
  }
}

§ 2Iconsets

An iconset renames a pack or sets default styling (pack / size / color); a bare :name: then reads from that set.

PropertyTypeRequiredDescription
nameidentifieryesReference name (the label slot), e.g. ui — used by set = ui and :ui.name:.
packutf8noBundled pack to read from (lucide / bootstrap); defaults to the set name.
sizeutf8noDefault inline size for icons in this set (e.g. "1em", "20px").
colorutf8noDefault foreground — drives currentColor.
fillutf8noOptional explicit fill override.
backgroundutf8noOptional background override.
classlist<utf8>noClasses added to every icon from this set.

Child blocks

SlotAcceptsMultipleDescription
iconsicon_defyesPer-icon override children (see below).

An icon_def child of an iconset overrides an individual icon within the set — for example giving one glyph its own color.

PropertyTypeRequiredDescription
nameidentifieryesIcon name (the file stem in the pack) — the label slot.
sizeutf8noPer-icon override of the set's default size.
colorutf8noPer-icon override of the set's default foreground colour.
fillutf8noPer-icon override of the set's default fill.
backgroundutf8noPer-icon override of the set's default background.
classlist<utf8>noPer-icon classes added on top of the set defaults.

Declare an iconset to rename a pack or set default styling; per-icon icon_def children override individual icons within the set. A bare :name: then reads from that set. (An iconset is a document-root declaration, so this one is shown as source rather than a live preview.)

wcl
iconset ui {
  pack  = "lucide"
  size  = "1.15em"
  color = "var(--wdoc-accent)"
  icon_def "heart" { color = "#bf616a" }
}

p "We :heart: WCL."

As a shape badge, icon_pos accepts :center, :top_left (default), :top_right, :bottom_left, :bottom_right, :left, :right.