Reference
Skeleton
Placeholder shape shown while content loads.
Skeleton(height: String, width: String, size: String, …)
Before 5.0
size
Example
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
state loading = true
if loading {
Stack(gap: .sm) {
Skeleton(height: "20px")
Skeleton(height: "20px")
}
} else {
Text("Loaded")
}
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
height: | String | none: no height of its own | Its height, a CSS length ( |
width: | String | none: the width of its container | Its width, a CSS length ( |
size: | String | none | The diameter of a |
circle: | Bool | false | Round instead of a rounded rectangle, for an avatar's place. Written as a flag, |
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.