Reference

Skeleton

Placeholder shape shown while content loads.

Skeleton(height: String, width: String, size: String, …)

Before 5.0

size

Example

wf

Row(gap: .md, align: .center) { Skeleton(size: "48px").circle Stack(gap: .sm) { Skeleton(height: "16px", width: "180px") Skeleton(height: "12px", width: "260px") Skeleton(height: "12px", width: "220px") } }

While a list loads

wf

state loading = true if loading { Stack(gap: .sm) { Skeleton(height: "20px") Skeleton(height: "20px") } } else { Text("Loaded") }

Props

Props of Skeleton
PropTypeUnsetMeaning

height:

String

none: no height of its own

Its height, a CSS length ("20px", "1.5rem"); a value that reads state follows it

width:

String

none: the width of its container

Its width, a CSS length ("200px", "60%")

size:

String

none

The diameter of a .circle, a CSS length, used for any of width: and height: not given; ignored without .circle

circle:

Bool

false

Round instead of a rounded rectangle, for an avatar's place. Written as a flag, .circle, or circle: 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.

.circle

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