Reference

Tag

Compact chip.

Tag(_ label: String)

Before 5.0

label

Slow roasting, explained

Cooking Technique Long read

Example

wf

Stack(gap: .sm) { Heading("Slow roasting, explained").h3 Row(gap: .xs) { Tag("Cooking") Tag("Technique") Tag("Long read") } }

Drawn from a list

wf

state topics = ["rust", "web", "compilers"] Row(gap: .xs) { for topic in topics by topic { Tag(topic) } }

Props

Props of Tag
PropTypeUnsetMeaning

label

String (positional)

none

The tag's text; unset, its block

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.

No flags of its own.

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-tag, stable across releases, so a stylesheet may target it.