Reference
HoverCard
A preview card at a link or a button: shown after delay: ms of hover, at once on focus; it stays while the pointer is on it, and goes when the pointer leaves both, on Escape or on a press outside.
HoverCard(delay: Number) { … }
Since 6.2.0
delay
Reviewed by
Example
Text("Reviewed by") {
HoverCard(delay: 300) {
Link("@ada", to: "/showcase")
HoverCard.Content {
Row(gap: .sm, align: .center) {
Avatar(initials: "AL").primary
Stack(gap: .xs) {
Text("Ada Lovelace").bold
Text("Wrote the first program.").muted.sm
}
}
}
}
}
At once, on a button
HoverCard(delay: 0) {
Button("Pro plan")
HoverCard.Content { Text("Unlimited projects and priority support.") }
}
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
delay: | Number | 500 | How long the pointer rests on the control before the card shows, in ms; focus shows it at once, and it goes 300 ms after the pointer leaves both |
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 HoverCard are written under its name, inside it. Each is described here, with what it takes.
HoverCard.Content
What the card shows. The rest of the block is what it is at.
HoverCard.Content { … }
Renders with the class wf-hover-card, stable across releases, so a stylesheet may target it.