Reference

Item

A row of a list, a settings page or a search's results: Item.Media at its start, its title: and description:, then its block, and Item.Actions at its end.

Item(title: String, description: String) { … }

Since 6.2.0

title

description

Push notifications

Sent to your phone when a deploy fails

Weekly digest

A summary every Monday morning

Example

wf

state push = true state digest = false Stack(gap: .sm) { Item(title: "Push notifications", description: "Sent to your phone when a deploy fails") { Item.Media { Icon("bell") } Item.Actions { Switch(bind: push, aria-label: "Push notifications") } } Item(title: "Weekly digest", description: "A summary every Monday morning") { Item.Media { Icon("mail") } Item.Actions { Switch(bind: digest, aria-label: "Weekly digest") } } }

A search result with a link and a badge

wf

Item(title: "Forms and validation", description: "Rules beside the state they guard.") { Item.Media { Icon("book") } Item.Actions { Badge("Guide").info } }

Its words written by hand

wf

Item { Item.Media { Avatar(initials: "AL").sm } Item.Content { Text("Ada Lovelace").bold Text("Commented on your pull request").muted.sm } Item.Actions { Button("Open").sm } }

Props

Props of Item
PropTypeUnsetMeaning

title:

String

none

What it is: a bold line before the rest of its block

description:

String

none

A line under the title, small and muted

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

children

Parts

The parts of Item are written under its name, inside it. Each is described here, with what it takes.

Item.Media

What goes at its start: an icon, an avatar, a picture.

Item.Media { … }

Item.Actions

What goes at its end: a switch, a button, a menu.

Item.Actions { … }

Drawn for it

What Item draws itself, by the class a stylesheet can select. They are not written.

Drawn for it
PartClassMeaning

Item.Content

—

Its title, description and block.

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