Reference
Kbd
A key or a combination, written as this system writes it: Kbd("mod+k") is ⌘K on a Mac and Ctrl+K elsewhere.
Kbd(_ keys: String)
Since 6.2.0
keys
Press
Ctrl+Kto search the docs.
Send with
Shift+Enterand close with
EscExample
Stack(gap: .xs) {
Row(gap: .xs, align: .center) { Text("Press") Kbd("mod+k") Text("to search the docs.") }
Row(gap: .xs, align: .center) { Text("Send with") Kbd("shift+Enter") Text("and close with") Kbd("Escape") }
}
A chord
Row(gap: .xs, align: .center) { Text("Save all:") Kbd("mod+k mod+s") }
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
keys | String (positional) | — | The combination, as |
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
It takes no slots.
Renders with the class wf-kbd, stable across releases, so a stylesheet may target it.