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+K

to search the docs.

Send with

Shift+Enter

and close with

Esc

Example

wf

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

wf

Row(gap: .xs, align: .center) { Text("Save all:") Kbd("mod+k mod+s") }

Props

Props of Kbd
PropTypeUnsetMeaning

keys

String (positional)

—

The combination, as on key names it (mod+k, shift+Enter), written as this system writes it: ⌘K on a Mac, Ctrl+K elsewhere and in the static paint

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.