Reference
Card
Card surface with optional header, body and footer sections.
Card(surface: Enum) { … }
Before 5.0
surface
Pro
PopularEverything in Free, and more.
-
Unlimited projects
-
Priority support
Example
Card.elevated {
Card.Header {
Row(justify: .between, align: .center) {
Heading("Pro").h3
Badge("Popular").primary.pill
}
}
Card.Body {
Text("Everything in Free, and more.").muted
List {
List.Item { Text("Unlimited projects") }
List.Item { Text("Priority support") }
}
}
Card.Footer { Button("Choose Pro").primary.full }
}
A plain box: no parts, only what it holds
Card.outlined { Text("Drafts are kept for 30 days.") }
Flat, in a grid of cards
Grid(columns: { base: 1, md: 3 }, gap: .md) {
Card.flat { Heading("Free").h3 Text("For trying it out") }
Card.elevated { Heading("Pro").h3 Text("For a team") }
Card.flat { Heading("Scale").h3 Text("For many teams") }
}
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
surface: | one of its cases | none: the surface colour with a 1px border, no shadow | How it stands off the page. 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.
.flat
.elevated
.outlined
Events
Every element also takes the props, the events and the attribute families listed on every element.
Slots
children
Parts
The parts of Card are written under its name, inside it. Each is described here, with what it takes.
Card.Header
The card's heading area.
Card.Header { … }
Card.Body
The card's content area.
Card.Body { … }
Card.Footer
The card's action area.
Card.Footer { … }
Renders with the class wf-card, stable across releases, so a stylesheet may target it.